Materialclass
A material. Uses several `Sandbox.Texture`s and a `Sandbox.Material.Shader` with specific settings for more interesting visual effects.
Methods19
Showing 19 methods
public static Sandbox.Material Create(string materialName, string shader, bool anonymous = True)
Create a new empty material at runtime.
| Parameter | Type | Description |
|---|---|---|
| materialName | string | Name of the new material. |
| shader | string | Shader that the new material will use. |
| anonymous = True | bool | If false, material can be found by name. |
public Sandbox.Material CreateCopy(string name = null)
Create a copy of this material
| Parameter | Type | Description |
|---|---|---|
| name = null | string | — |
public Color GetColor(string name)
Get Color parameter, by name
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
public int GetFeature(string name)
Get a feature flag on the material. This is usually used to enable/disable shader permutations.
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
int—public Sandbox.Texture GetTexture(string name)
Get texture parameter, by name
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
public Vector4 GetVector4(string name)
Get Vector4 parameter, by name
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
public static Sandbox.Material Load(string filename)
Load a material from disk. Has internal cache.
| Parameter | Type | Description |
|---|---|---|
| filename | string | The filepath to load the material from. |
public static System.Threading.Tasks.Task`1<Sandbox.Material> LoadAsync(string filename)
Load a material from disk. Has internal cache.
| Parameter | Type | Description |
|---|---|---|
| filename | string | The filepath to load the material from. |
public void SetFeature(string name, int value)
Set a feature flag on the material. This is usually used to enable/disable shader permutations. This is kind of a define, also known as a combo.
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
| value | int | — |
void—No results match this filter.
Properties7
Showing 7 properties
public Sandbox.RenderAttributes Sandbox.Material.Attributes { get; set; }
Access to all of the attributes of this material.
public Sandbox.Texture Sandbox.Material.FirstTexture { get; set; }
Get thje first texture assigned to this material, if any.
public Sandbox.Material.FlagsAccessor Sandbox.Material.Flags { get; set; }
Access flags on this material, which usually hint about the contents. These are generally added by the shader procedurally - but developers can add these in material editor too.
public virtual bool Sandbox.Material.IsValid { get; set; }
bool—public string Sandbox.Material.Name { get; set; }
Name (or path) of the material.
string—public string Sandbox.Material.ShaderName { get; set; }
Gets the underlying shader name for this material.
string—No results match this filter.