Garry's Mod Wiki

Revision Difference

Entity:SetMaterial#525280

<function name="SetMaterial" parent="Entity" type="classfunc"> <description> Sets the rendering material override of the entity. To set a Lua material created with <page>Global.CreateMaterial</page>, just prepend a "!" to the material name. <note>If you wish to override a single material on the model, use <page>Entity:SetSubMaterial</page> instead.</note> <note>Please note that to apply materials to models, that material **must** have VertexLitGeneric shader. For that reason you cannot apply map textures onto models, map textures use a different material shader - LightmappedGeneric.</note> <bug issue="3362">The server's value takes priority on the client.</bug> </description> <realm>Shared</realm> <args> <arg name="materialName" type="string">New material name. Use an empty string ("") to reset to the default materials.</arg> <arg name="forceMaterial" type="boolean" default="false">Use it if you wish to apply material other than VertexLitGeneric (such as tools/toolswhite).</arg>⤶ </args> </function>