I have it set up like this:
- Enemy get destroyed
- GUI pops up
- The script that is attached to the GUI tells it to wait for 2 seconds and then disable itself.
The problem is, I don’t know how start a function as soon as the object is SetActive. I’ve tried the Start function of course (as seen below) but when the object gets enabled for a second time the Start function does not run again.
#pragma strict
var delay : float = 2;
function Start ()
{
yield WaitForSeconds(delay);
gameObject.SetActive(false);
}