void Update() { float timeLeft = (timeUntilDeath - (Time.time - timeCreated)) / timeUntilDeath; Color newColor = new Color(oldColor.r, oldColor.g, oldColor.b, oldColor.a * timeLeft); rend.material.SetColor("_Color", newColor); if (Time.time > timeCreated + timeUntilDeath) { manager.deathOrb(this); } }