My player is invincible for 2 seconds after taking a hit. I'm trying to make him blink during this time, but it's not happening visually, even though my code seems perfect to me.
The blinking code that doesn't work:
Blinking Sprite Renderer - Why Doesn't This Work?
The blinking code that doesn't work:
Code (CSharp):
- public bool isImmortal;
- [SerializeField] public float immortalityTime;
- [SerializeField] private SpriteRenderer sprite;
- private IEnumerator Blink()
- {
- while (isImmortal)
- {
- sprite.enabled = false;
- }
- yield return...