I have made a script that pulses between 0 and 1 to set emissions of an attached sprite render object’s material.
I use this following code:
private void PulseItem()
{
Color baseColor = Color.yellow;
float emission = Mathf.PingPong (Time.time, 1.0f);
_mat.SetColor("_EmissionColor", baseColor * emission);
}
The code doesn’t work until I click the shader in the inspector. Is this a bug?