API
The following section describes the exposed properties of the shader. You can use those properties to dynamically change various shader options 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 sprite 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");
_Main_Col
The albedo color of the texture.
See Albedo Color for more information.
Usage
With
material being the material of the object's sprite renderer,
and newColor being the albedo color you would like to apply to the object,
set the value like so:material.SetColor("_Main_Col", newColor);
and read it like so:
Color color = material.GetColor("_Main_Col");
_Alpha_Cutoff
The alpha cutoff value.
See Alpha Cutoff for more information.
Usage
With
material being the material of the object's sprite renderer,
and newCutoff being the cutoff value you would like to apply to the object,
set the value like so:material.SetFloat("_Alpha_Cutoff", newCutoff);
and read it like so:
float cutoff = material.GetFloat("_Alpha_Cutoff");
_Ambient_Occlusion
The regular ambient occlusion from the URP standard lit shader.
See Ambient Occlusion for more information.
NOTE: This property is not available in the 2D Renderer version of the shader.
Usage
With
material being the material of the object's sprite renderer,
and newAmbientOcclusion being the ambient occlusion value you would like to apply to the object,
set the value like so:material.SetFloat("_Ambient_Occlusion", newAmbientOcclusion);
and read it like so:
float occlusion = material.GetFloat("_Ambient_Occlusion");
_Metallic_Map
The metallic map.
See Metallic Map for more information.
NOTE: This property is not available in the 2D Renderer version of the shader.
Usage
With
material being the material of the object's sprite renderer,
and newMap being the metallic map you would like to apply to the object,
set the value like so:material.SetTexture("_Metallic_Map", newMap);
and read it like so:
Texture metallicMap = material.GetTexture("_Metallic_Map");
_Metallic
The metallic value applied on top of the metallic map.
See Metallic for more information.
NOTE: This property is not available in the 2D Renderer version of the shader.
Usage
With
material being the material of the object's sprite 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");
_Normal_Map
The normal (bump) map.
See Normal Map for more information.
Usage
With
material being the material of the object's sprite renderer,
and newMap being the normal map you would like to apply to the object,
set the value like so:material.SetTexture("_Normal_Map", newMap);
and read it like so:
Texture normalMap = material.GetTexture("_Normal_Map");
_Normal_Strength
The strength of the normal map.
See Normal Strength for more information.
Usage
With
material being the material of the object's sprite renderer,
and newStrength being the normal strength value you would like to apply to the object,
set the value like so:material.SetFloat("_Normal_Strength", newStrength);
and read it like so:
float strength = material.GetFloat("_Normal_Strength");
_Primary_Emission_Map
The primary emission map.
See Primary Emission Map for more information.
Usage
With
material being the material of the object's sprite renderer,
and newMap being the emission map you would like to apply to the object,
set the value like so:material.SetTexture("_Primary_Emission_Map", newMap);
and read it like so:
Texture emissionMap = material.GetTexture("_Primary_Emission_Map");
_Primary_Emission_Col
The color of the primary emission.
See Primary Emission Color for more information.
Usage
With
material being the material of the object's sprite renderer,
and newColor being the emission color you would like to apply to the object,
set the value like so:material.SetColor("_Primary_Emission_Col", newColor);
and read it like so:
Color color = material.GetColor("_Primary_Emission_Col");
_Primary_Emission_Extra_Intensity
An additional intensity value for finer control of the primary emission.
See Primary Emission Extra Intensity for more information.
Usage
With
material being the material of the object's sprite renderer,
and newIntensity being the emission intensity value you would like to apply to the object,
set the value like so:material.SetFloat("_Primary_Emission_Extra_Intensity", newIntensity);
and read it like so:
float intensity = material.GetFloat("_Primary_Emission_Extra_Intensity");
_Secondary_Emission_Map
The secondary emission map.
See Secondary Emission Map for more information.
Usage
With
material being the material of the object's sprite renderer,
and newMap being the emission map you would like to apply to the object,
set the value like so:material.SetTexture("_Secondary_Emission_Map", newMap);
and read it like so:
Texture emissionMap = material.GetTexture("_Secondary_Emission_Map");
_Secondary_Emission_Col
The color of the secondary emission.
See Secondary Emission Color for more information.
Usage
With
material being the material of the object's sprite renderer,
and newColor being the emission color you would like to apply to the object,
set the value like so:material.SetColor("_Secondary_Emission_Col", newColor);
and read it like so:
Color color = material.GetColor("_Secondary_Emission_Col");
_Secondary_Emission_Extra_Intensity
An additional intensity value for finer control of the secondary emission.
See Secondary Emission Extra Intensity for more information.
Usage
With
material being the material of the object's sprite renderer,
and newIntensity being the emission intensity value you would like to apply to the object,
set the value like so:material.SetFloat("_Secondary_Emission_Extra_Intensity", newIntensity);
and read it like so:
float intensity = material.GetFloat("_Secondary_Emission_Extra_Intensity");