SMaterial Instantiate()
Return a new SMaterial from old.
void SetFloat (string key, float value)
Sets a shader property to value
float GetFloat (string key)
Gets the current value of a shader property.
void SetColor (string key, SColor color) void SetColor (string key, float r, float g, float b, float a)
Sets a shader colour
SColor GetColor (string propertyName)
Get a named color value. Many shaders use more than one color. Use GetColor to get the propertyName color.
void SetColor32 (string key, byte r, byte g, byte b, byte a)
Sets a shader colour to value (32-bit, 0..255 values)
void SetInt (string key, int value)
Sets a shader property to value. This can be a convenient way to work with Boolean values.
int GetInt (string key)
Gets the current value of a shader property. This can be a convenient way to work with Boolean values.
void SetTexture (string key, SResource value)
Sets a object's specified texture map (specified in parameter 1) to the texture provided as a resource in parameter #2. The example script must be in a object with a '_MainTex' map, and that object should be set as a resource on the scripting runtime. Additionally, that object should be called 'dispobj'.
note also that this function can be used to set any of the texture maps by varying the value of the first parameter accordingly.
SResource GetTexture (string propertyName)
Get a named texture. Many shaders use more than one texture. Use GetTexture to get the propertyName texture.
void SetTextureOffset (string key, float x, float y)
Sets a texture offset to a value.
void SetTextureScale (string key, float x, float y)
Sets a texture scale to a value.
void SetVector (string key, SVector value)
Sets a shader property to value
string Name get
set
Return a new SMaterial from old.
string Shader get
Return the shader name of current SMaterial.
int RenderQueue get
set
Render queue of this material.
By default materials use render queue of the shader it uses. You can override the render queue used using this variable. Note that if a shader on the material is changed, the render queue resets to that of the shader itself.
Render queue value should be in [0..5000] range to work properly; or -1 to use the render queue from the shader.
Function |
---|
Property | Description |
---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
Parameter | Type | Description |
---|---|---|
SMaterial Instantiate()
void SetFloat (string key, float value)
float GetFloat (string key)
void SetColor32 (string key, byte r, byte g, byte b, byte a)
void SetInt (string key, int value)
int GetInt (string key)
void SetTexture (string key, SResource value)
SResource GetTexture (string key)
void SetTextureOffset (string key, float x, float y)
void SetTextureScale (string key, float x, float y)
void SetVector (string key, SVector value)
string Name get
set
string Shader get
int RenderQueue get
set
propertyName
string
Common color names used by Unity's builtin shaders: "_Color" is the main color of a material.
"_SpecColor" is the specular color of a material (used in specular/glossy/vertexlit shaders).
"_EmissionColor" is the emissive color of a material (used in vertexlit shaders). "_ReflectColor" is the reflection color of the material (used in reflective shaders).
propertyName
string
Common texture names used by Unity's builtin shaders:
"_MainTex" is the main diffuse texture.
"_BumpMap" is the normal map. "_Cube" is the reflection cubemap.