I am trying to make the characters color fade. When accessing the alpha, its not throwing errors, but when I pause the game it remains at 255 when it should be droping. Since the “Health” variable is changing. Health is capped between 0 - 100.
Here is the part of the code.
public float health;
public GUIStyle myStyle;
public bool enable;
public float multiplier;
void Start()
{
health = 100;
multiplier = 1;
}
void Update ()
{
SpriteRenderer renderer = this.GetComponent<SpriteRenderer>();
renderer.color = new Color(0f, 0f, 0f, health + 155f);