API
The following section describes the exposed properties of the shader. You can use these properties to change the shader options dynamically from your own scripts.
_MainTex
The main (albedo/color) texture used by the shader.
See Albedo Texture for more information.
Usage
With
material being the material of the object's mesh renderer,
and newTexture being the albedo texture you would like to apply to the object,
set the value like so:material.SetTexture("_MainTex", newTexture);
and read it like so:
Texture texture = material.GetTexture("_MainTex");
_BaseColor
An additional color multiplied with the one already present in the albedo texture.
See Albedo Color for more information.
Usage
With
material being the material of the object's mesh renderer,
and newColor being the albedo color you would like to apply to the object,
set the value like so:material.SetColor("_BaseColor", newColor);
and read it like so:
Color color = material.GetColor("_BaseColor");
_AlphaCutoff
The alpha cutoff threshold value.
See Alpha Cutoff for more information.
Usage
With
material being the material of the object's mesh renderer,
and newCutoff being the cutoff value you would like to apply to the object,
set the value like so:material.SetFloat("_AlphaCutoff", newCutoff);
and read it like so:
float cutoff = material.GetFloat("_AlphaCutoff");
_AmbientOcclusion
A value between 0 and 1 that controls how much ambient (indirect) light reaches the surface.
See Ambient Occlusion for more information.
Usage
With
material being the material of the object's mesh renderer,
and newAmbientOcclusion being the ambient occlusion value you would like to apply to the object,
set the value like so:material.SetFloat("_AmbientOcclusion", newAmbientOcclusion);
and read it like so:
float occlusion = material.GetFloat("_AmbientOcclusion");
_MetallicMap
The metallic map.
See Metallic Map for more information.
Usage
With
material being the material of the object's mesh renderer,
and newMap being the metallic map you would like to apply to the object,
set the value like so:material.SetTexture("_MetallicMap", newMap);
and read it like so:
Texture metallicMap = material.GetTexture("_MetallicMap");
_Metallic
The metallic value applied on top of the metallic map.
See Metallic for more information.
Usage
With
material being the material of the object's mesh renderer,
and newMetallic being the metallic value you would like to apply to the object,
set the value like so:material.SetFloat("_Metallic", newMetallic);
and read it like so:
float metallic = material.GetFloat("_Metallic");
_NormalMap
The normal (bump) map.
See Normal Map for more information.
Usage
With
material being the material of the object's mesh renderer,
and newMap being the normal map you would like to apply to the object,
set the value like so:material.SetTexture("_NormalMap", newMap);
and read it like so:
Texture normalMap = material.GetTexture("_NormalMap");
_NormalStrength
The strength of the normal map.
See Normal Strength for more information.
Usage
With
material being the material of the object's mesh renderer,
and newStrength being the normal strength value you would like to apply to the object,
set the value like so:material.SetFloat("_NormalStrength", newStrength);
and read it like so:
float strength = material.GetFloat("_NormalStrength");
_PrimaryEmissionMap
The primary emission map.
See Primary Emission Map for more information.
Usage
With
material being the material of the object's mesh renderer,
and newMap being the emission map you would like to apply to the object,
set the value like so:material.SetTexture("_PrimaryEmissionMap", newMap);
and read it like so:
Texture emissionMap = material.GetTexture("_PrimaryEmissionMap");
_PrimaryEmissionColor
The HDR color of the primary emission.
See Primary Emission Color for more information.
Usage
With
material being the material of the object's mesh renderer,
and newColor being the emission color you would like to apply to the object,
set the value like so:material.SetColor("_PrimaryEmissionColor", newColor);
and read it like so:
Color color = material.GetColor("_PrimaryEmissionColor");
_PrimaryEmissionExtraIntensity
An additional intensity value that makes the primary emission stronger than the HDR color alone allows.
See Primary Emission Extra Intensity for more information.
Usage
With
material being the material of the object's mesh renderer,
and newIntensity being the extra intensity value you would like to apply to the object,
set the value like so:material.SetFloat("_PrimaryEmissionExtraIntensity", newIntensity);
and read it like so:
float intensity = material.GetFloat("_PrimaryEmissionExtraIntensity");
_SecondaryEmissionMap
The secondary emission map.
See Secondary Emission Map for more information.
Usage
With
material being the material of the object's mesh renderer,
and newMap being the emission map you would like to apply to the object,
set the value like so:material.SetTexture("_SecondaryEmissionMap", newMap);
and read it like so:
Texture emissionMap = material.GetTexture("_SecondaryEmissionMap");
_SecondaryEmissionColor
The HDR color of the secondary emission.
See Secondary Emission Color for more information.
Usage
With
material being the material of the object's mesh renderer,
and newColor being the emission color you would like to apply to the object,
set the value like so:material.SetColor("_SecondaryEmissionColor", newColor);
and read it like so:
Color color = material.GetColor("_SecondaryEmissionColor");
_SecondaryEmissionExtraIntensity
An additional intensity value that makes the secondary emission stronger than the HDR color alone allows.
See Secondary Emission Extra Intensity for more information.
Usage
With
material being the material of the object's mesh renderer,
and newIntensity being the extra intensity value you would like to apply to the object,
set the value like so:material.SetFloat("_SecondaryEmissionExtraIntensity", newIntensity);
and read it like so:
float intensity = material.GetFloat("_SecondaryEmissionExtraIntensity");