{"name":"getObjectMaterials","operator":null,"title":"getObjectMaterials","type":"command","url":"https://community.bistudio.com/wiki/getObjectMaterials","revid":370528,"updated":"2025-01-01T23:24:06Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.38"}],"since":{"game":"arma3","name":"Arma 3","version":"1.38"},"arma3_since":"1.38","branch":null,"locality":{"argument":"global","effect":null,"server_exec":false},"exec":null,"description":"Gets all custom materials associated with the object.","syntaxes":[{"syntax":"getObjectMaterials obj","since":null,"effect":null,"exec":null,"params":[{"name":"obj","type":"Object","optional":false,"default":null,"description":null,"types":["Object"],"since":null,"text":"obj: Object"}],"returns":{"type":"Array of Strings","types":["Array","String"],"description":"array of materials","text":"Array of Strings - array of materials"},"form":"unary","operator":null,"left":null,"right":{"text":"obj","types":["Object"]}},{"syntax":"obj getObjectMaterials sels","since":"Arma3 2.20","effect":null,"exec":null,"params":[{"name":"obj","type":"Object","optional":false,"default":null,"description":"entity","types":["Object"],"since":null,"text":"obj: Object - entity"},{"name":"sels","type":"Array","optional":false,"default":null,"description":"array of index(es) and/or selection(s). If array is empty [] - default object materials are returned (see example 3)","types":["Array"],"since":null,"text":"sels: Array - array of index(es) and/or selection(s). If array is empty [] - default object materials are returned (see example 3)"}],"returns":{"type":"Array of Strings","types":["Array","String"],"description":"array of materials in order of 'sels'. Non existing materials filled with nils.","text":"Array of Strings - array of materials in order of 'sels'. Non existing materials filled with nils."},"form":"binary","operator":null,"left":{"text":"obj","types":["Object"]},"right":{"text":"sels","types":["Array"]}}],"examples":[{"text":"```sqf\n_materials = getObjectMaterials car;\n```","code":["_materials = getObjectMaterials car;"]},{"text":"```sqf\nplayer setObjectMaterial [\"insignia\", \"A3\\Structures_F\\Data\\Windows\\window_set.rvmat\"];\nplayer getObjectMaterials [\"insignia\", 0, 1, player, \"dskjhkjhsad\"]; \n// [\"a3\\structures_f\\data\\windows\\window_set.rvmat\",\"\",\"a3\\structures_f\\data\\windows\\window_set.rvmat\",<null>,<null>]\n```","code":["player setObjectMaterial [\"insignia\", \"A3\\Structures_F\\Data\\Windows\\window_set.rvmat\"];\nplayer getObjectMaterials [\"insignia\", 0, 1, player, \"dskjhkjhsad\"]; \n// [\"a3\\structures_f\\data\\windows\\window_set.rvmat\",\"\",\"a3\\structures_f\\data\\windows\\window_set.rvmat\",<null>,<null>]"]},{"text":"```sqf\nplayer setObjectMaterial [0, \"a3\\structures_f\\data\\windows\\window_set.rvmat\"];\ngetObjectMaterials player; // [\"a3\\structures_f\\data\\windows\\window_set.rvmat\",\"\"]\nplayer getObjectMaterials []; // [\"\",\"\"]\n```","code":["player setObjectMaterial [0, \"a3\\structures_f\\data\\windows\\window_set.rvmat\"];\ngetObjectMaterials player; // [\"a3\\structures_f\\data\\windows\\window_set.rvmat\",\"\"]\nplayer getObjectMaterials []; // [\"\",\"\"]"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["setObjectMaterial","setObjectTextureGlobal","getObjectTextures","setObjectTexture","setObjectMaterialGlobal"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Arma 3 version 1.38","Scripting Commands"]}