I’m working on a GUI and have an arrow on the screen and I want to flash every 3 seconds, does anyone know how I can do this because I’ve been there a few days beizg and I can not find it.
I have an example below at how I did it:
void OnGUI()
{
if (GOON)
{
GOON = true;
GUI.Label(new Rect(Screen.width/2+330,200,260,80), arrowright);
}
}
IEnumerator Life()
{
yield return new WaitForSeconds(.05f);
lifetime-=.05f;
if(lifetime<=0)
{
Destroy(transform.parent.gameObject);
}
if(lifetime <= 3 && !isflickering)
{
StartCoroutine("Flicker");
StartCoroutine("Life");
}
else
{
StartCoroutine("Life");
}
}
IEnumerator Flicker()
{
isflickering = true;
yield return new WaitForSeconds(.3f);
renderer.enabled = false;
yield return new WaitForSeconds(.3f);
renderer.enabled = true;
}