{"name":"getObjectMaterials","title":"getObjectMaterials","type":"command","url":"https://community.bistudio.com/wiki/getObjectMaterials","revid":370528,"updated":"2025-01-01T23:24:06Z","groups":["Object Manipulation"],"status":"ok","games":{"arma3":"1.38"},"since":"arma3 1.38","arma3_since":"1.38","locality":{"argument":"global"},"description":"Gets all custom materials associated with the object.","syntaxes":[{"syntax":"getObjectMaterials obj","params":[{"name":"obj","type":"Object","type_expr":"Object"}],"returns":{"type":"Array of Strings","type_expr":"Array<String>","description":"array of materials"},"form":"unary","right":{"text":"obj"}},{"syntax":"obj getObjectMaterials sels","since":"arma3 2.20","params":[{"name":"obj","type":"Object","description":"entity","type_expr":"Object"},{"name":"sels","type":"Array","description":"array of index(es) and/or selection(s). If array is empty [] - default object materials are returned (see example 3)","type_expr":"Array"}],"returns":{"type":"Array of Strings","type_expr":"Array<String>","description":"array of materials in order of 'sels'. Non existing materials filled with nils."},"form":"binary","left":{"text":"obj"},"right":{"text":"sels"}}],"examples":[{"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>]"]},{"code":["player setObjectMaterial [0, \"a3\\structures_f\\data\\windows\\window_set.rvmat\"];\ngetObjectMaterials player; // [\"a3\\structures_f\\data\\windows\\window_set.rvmat\",\"\"]\nplayer getObjectMaterials []; // [\"\",\"\"]"]}],"see_also":["setObjectMaterial","setObjectTextureGlobal","getObjectTextures","setObjectTexture","setObjectMaterialGlobal"]}