- using a static variable will automatically include it as a shader uniform
example:
class Shader : CanvasShader
{
public float time;
public override ColorF GetPixelColor(Vector2 position)
{
return new ColorF(float.Sin(time), 0, 0, 1);
}
}
// time would have to be set before the shader is used
would become:
class Shader : CanvasShader
{
public override ColorF GetPixelColor(Vector2 position)
{
return new ColorF(float.Sin(Time.TotalTime), 0, 0, 1);
}
}
example:
would become: