I made this code because i needI needed an image to display a couple seconds after an enemy spawns, but for some reason iI can't make it work.
There's no error in the console, but it doesn't display the image and iI don't know what to do. Here's my script (it's attached to the enemy prefab)
public class enemyAttack : MonoBehaviour {
public float time = 5f;
private IEnumerator coroutine;
public Image image;
private float t = 5f;
void Start ()
{
//image.gameObject.SetActive (false);
image.enabled = false;
coroutine = nombredeCorutina (time, image);
StartCoroutine (coroutine);
}
private IEnumerator nombredeCorutina (float t, Image im)
{
image.enabled = true;
//im.gameObject.SetActive (true);
yield return new WaitForSeconds (t);
coroutine = nombredeCorutina (time, im);
StartCoroutine (coroutine);
}
}
}