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 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");

_BaseColor

An additional color multiplied with the one already present in the albedo texture. Use this to further customize the look of your sprite. 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("_BaseColor", newColor);
and read it like so:
Color color = material.GetColor("_BaseColor");

_Cutoff

This is a threshold value - all parts of the texture whose alpha value is less than the alpha cutoff will not be rendered. 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("_Cutoff", newCutoff);
and read it like so:
float cutoff = material.GetFloat("_Cutoff");

_MetallicGlossMap

The standard metallic map option in the default URP Lit shader. The metallic map is a black-and-white texture that determines the surface type of the object. It is used to make certain parts of the sprite reflect light like a metal would (metallic), and others like sand would (smooth). 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("_MetallicGlossMap", newMap);
and read it like so:
Texture metallicMap = material.GetTexture("_MetallicGlossMap");

_Metallic

This value determines how "metallic" the surface should be, i.e., whether it should reflect light like a metal or a wet surface, or should absorb it like sand or another rough, non-metallic surface. 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");

_BumpMap

The standard normal map option in the default URP Lit shader. The normal map is used to simulate a 3D-surface by containing information on how the light should be reflected by the surface. 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("_BumpMap", newMap);
and read it like so:
Texture normalMap = material.GetTexture("_BumpMap");

_BumpScale

This value is multiplied with the normal map and is used to make the effect stronger or weaker. A negative value will mirror the 3D-effect (i.e., protruding surfaces will now be concave, and vice versa). 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("_BumpScale", newStrength);
and read it like so:
float strength = material.GetFloat("_BumpScale");

_EmissionMap

The standard emission map option in the default URP Lit shader. A black-and-white map that determines which parts of the sprite will emit light. The white pixels of the texture are areas where the emission will have an effect, and the black pixels are the areas with no emission. 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("_EmissionMap", newMap);
and read it like so:
Texture emissionMap = material.GetTexture("_EmissionMap");

_EmissionColor

The emission color as an HDR color. Keep in mind that different post-processing effects (most notably bloom) will have a profound effect on the look of your 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("_EmissionColor", newColor);
and read it like so:
Color color = material.GetColor("_EmissionColor");

_EmissionExtraIntensity

Since the default HDR color has a limited intensity (-10 to 10), this shader offers an additional intensity option that allows you to make your emission even stronger. 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("_EmissionExtraIntensity", newIntensity);
and read it like so:
float intensity = material.GetFloat("_EmissionExtraIntensity");

_VibrationAmount

The strength of the vibration, i.e., how far the vertices of the sprite are displaced from their resting position. Set to 0 to bring the sprite completely to rest. Larger values produce a more violent shake. See Vibration Amount for more information.

Usage

With material being the material of the object's sprite renderer, and newAmount being the vibration amount value you would like to apply to the object, set the value like so:
material.SetFloat("_VibrationAmount", newAmount);
and read it like so:
float amount = material.GetFloat("_VibrationAmount");

_VibrationSpeed

How quickly the vibration oscillates. Set to 0 to freeze the displacement in a single, static deformation. Larger values make the sprite tremble faster. See Vibration Speed for more information.

Usage

With material being the material of the object's sprite renderer, and newSpeed being the vibration speed value you would like to apply to the object, set the value like so:
material.SetFloat("_VibrationSpeed", newSpeed);
and read it like so:
float speed = material.GetFloat("_VibrationSpeed");

_VibrationVolatility

Controls how far apart in phase neighbouring vertices vibrate. A value of 0 makes the whole sprite pulse in sync, so the sprite keeps its shape and moves as a single body. Increasing the value spreads neighbouring vertices further apart across the wave cycle, which distorts and warps the sprite instead of merely moving it. See Vibration Volatility for more information.

Usage

With material being the material of the object's sprite renderer, and newVolatility being the vibration volatility value you would like to apply to the object, set the value like so:
material.SetFloat("_VibrationVolatility", newVolatility);
and read it like so:
float volatility = material.GetFloat("_VibrationVolatility");

_AmbientOcclusion

The regular ambient occlusion from the standard URP 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("_AmbientOcclusion", newAmbientOcclusion);
and read it like so:
float occlusion = material.GetFloat("_AmbientOcclusion");

_MainTex _BaseColor _Cutoff _MetallicGlossMap _Metallic _BumpMap _BumpScale _EmissionMap _EmissionColor _EmissionExtraIntensity _VibrationAmount _VibrationSpeed _VibrationVolatility _AmbientOcclusion