Skip to main content
2 of 2
Adjusted indentation of code.

You need to edit your code something like this:

public float time = 5f;
private IEnumerator coroutine;
public Image image;
private float t = 5f;

void Start() {
    image.enabled = false;
}

private IEnumerator nombredeCorutina(float t, Image im) {
    yield return new WaitForSeconds(t);
    image.enabled = true;
}

public void EnemySpawn() {
    //call enemey spawn whenver you want. it will register coroutine and you image will be displayed after given seconds
    //enemyspawn logic
    StartCoroutine(nombredeCorutina(t,image));
}

Now you have to identify that when should you disable your image and when you want to spawn enemy.