Garry's Mod Wiki

Revision Difference

Entity:GetMaterials#530560

<function name="GetMaterials" parent="Entity" type="classfunc"> <description> Returns all materials of the entity's model. This function is unaffected by <page>Entity:SetSubMaterial</page> as it returns the original materials. ⤶ <bug issue="3362">The server's values take priority on the client.</bug>⤶ <bug>The table returned by this function will not contain materials if they are missing from the disk/repository. This means that if you are attempting to find the ID of a material to replace with <page>Entity:SetSubMaterial</page> and there are missing materials on the model, all subsequent materials will be offset in the table, meaning that the ID you are trying to get will be incorrect.</bug> <bug issue="4853">This function causes performance issues and can produce stuttering when using complex models. A workaround is available on its github page. **This is fixed in the next update.**</bug> </description> <realm>Shared</realm> <rets> <ret name="" type="table">A table containing full paths to the materials of the model. <note>**[NEXT UPDATE](https://github.com/Facepunch/garrysmod-issues/issues/3216#issuecomment-833389872)**: If used on a brush model (including the map), it will return complete list of materials. For a model, it's limited to 128 materials.</note> <bug issue="3216">This table is limited to 127 materials, even if the entity has more. **This is fixed in the next update.**</bug></ret> </rets> </function>