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");
_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");
_Emission_Map
The emission map.
See 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("_Emission_Map", newMap);
and read it like so:
Texture emissionMap = material.GetTexture("_Emission_Map");
_Emission_Col
The color of the emission.
See 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("_Emission_Col", newColor);
and read it like so:
Color color = material.GetColor("_Emission_Col");
_Emission_Extra_Intensity
An additional intensity value for finer control of the emission.
See 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("_Emission_Extra_Intensity", newIntensity);
and read it like so:
float intensity = material.GetFloat("_Emission_Extra_Intensity");
_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");