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.
_PulseEdgeColor
The color of the pulse's edge.
See Pulse Edge Color for more information.
Usage
With
material being the shader material,
and newColor being the color you would like to apply to the pulse edge,
set the value like so:material.SetColor("_PulseEdgeColor", newColor);
and read it like so:
Color color = material.GetColor("_PulseEdgeColor");
_PulseCenter
The center point of the pulse.
See Pulse Center for more information.
Usage
With
material being the shader material,
and newCenter being the center point you would like to apply to the pulse,
set the value like so:material.SetVector("_PulseCenter", newCenter);
and read it like so:
Vector2 center = material.GetVector("_PulseCenter");
Note: Unity's
However, there exists an implicit conversion between
Material.GetVector
and Material.SetVector work with Vector4.
However, there exists an implicit conversion between
Vector2 and Vector4,
meaning that you can freely work with both types.
The shader itself only regards the x- and y-values of the vector and ignores the rest, if any.
_PulseLength
The duration of the pulse effect in seconds.
See Pulse Length for more information.
Usage
With
material being the shader material,
and newLength being the length value you would like to apply to the pulse,
set the value like so:material.SetFloat("_PulseLength", newLength);
and read it like so:
float length = material.GetFloat("_PulseLength");
_PulseStrength
The strength of the pulse's distortion.
See Pulse Strength for more information.
Usage
With
material being the shader material,
and newStrength being the strength you would like to apply to the pulse,
set the value like so:material.SetFloat("_PulseStrength", newStrength);
and read it like so:
float strength = material.GetFloat("_PulseStrength");
_PulseEdgeThickness
The thickness (width) of the pulse's edge.
See Pulse Edge Thickness for more information.
Usage
With
material being the shader material,
and newThickness being the thickness value you would like to apply to the pulse,
set the value like so:material.SetFloat("_PulseEdgeThickness", newThickness);
and read it like so:
float thickness = material.GetFloat("_PulseEdgeThickness");
_Stretch
The additional distance for the pulse effect to travel in order to completely leave the screen before disappearing.
See Stretch for more information.
Usage
With
material being the shader material,
and newStretch being the stretch you would like to apply to the pulse,
set the value like so:material.SetFloat("_Stretch", newStretch);
and read it like so:
float stretch = material.GetFloat("_Stretch");
_MainTex
The main texture of the shader. Leave it blank.
See Main Texture for more information.
_Controller
The controller value for the pulse effect.
See Controller for more information.
Usage
With
material being the shader material,
and newController being the controller value you would like to apply to the pulse,
set the value like so:material.SetFloat("_Controller", newController);
and read it like so:
float controller = material.GetFloat("_Controller");
_Debug
Starts indefinitely repeating the pulse.
Originally meant for testing purposes inside of the editor,
but could still be used from your own scripts in case you would like a repeating pulse.
See Debug for more information.
Usage
With
material being the shader material,
and newDebug being the debug value you would like to apply to the pulse,
set the value like so:material.SetInt("_Debug", newDebug);
and read it like so:
int debug = material.GetInt("_Debug");
Note: the debug property is a boolean, but no
Material.SetBoolean
or Material.GetBoolean exists.
Instead, use the Material.SetInt
and Material.GetInt methods and set the value either to 1 for true, or to 0 for false.
_FadeController
The controller value for fading the screen in and out during the pulse effect.
See Fade Controller for more information.
Usage
With
material being the shader material,
and newFadeController being the fade controller value you would like to apply to the pulse,
set the value like so:material.SetFloat("_FadeController", newFadeController);
and read it like so:
float fadeController = material.GetFloat("_FadeController");
_ScreenSizeRatio
The aspect ratio of the main camera's viewport.
See Screen Size Ratio for more information.
Usage
With
material being the shader material,
and newRatio being the screen size ratio you would like to apply to the pulse,
set the value like so:material.SetFloat("_ScreenSizeRatio", newRatio);
and read it like so:
float ratio = material.GetFloat("_ScreenSizeRatio");