Change color for one second then revert to normal.
I want it to happen so that whenever the raycast hits an enemy, it flashes a certain color for about 1 second, then reverts back to normal. I am using a coroutine for this.
IEnumerator Flasher()
{
rend.material.color = color;
yield return new WaitForSeconds(1f);
rend.material.color = Color.red;
}
The problem is that when I use this method, it only blinks the color for less than a second. Why does this happen, and how do I fix it?
Comment
Your answer
Follow this Question
Related Questions
Persistent Timers in Couroutines 0 Answers
Issues with video player coroutine 2 Answers
Co-routine a recursion help 0 Answers
Create events that fires off a coroutine from another script 0 Answers