Garry's Mod Wiki


Entity:SetMaterial( string materialName, boolean forceMaterial = false )


Sets the rendering material override of the entity.

To set a Lua material created with CreateMaterial, just prepend a "!" to the material name.

If you wish to override a single material on the model, use Entity:SetSubMaterial instead.
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.
The server's value takes priority on the client.


1 string materialName
New material name. Use an empty string ("") to reset to the default materials.
2 boolean forceMaterial = false
Use it if you wish to apply material other than VertexLitGeneric (such as tools/toolswhite).

Page Links

Special Pages



Render Time: 32ms

Session 0
DB GetPage 3
Generate Html 7
SaveChanges 14
Render Body 0
Render Sidebar 6