i’m trying to get the effect of snakes dropping from an unseen ceiling. I need to use c# as thats what my health script is wirtten in. The only problem is… nothing happens. I get the error, “Awake can not be a co routine” heres my code. Do you see the problem?
using UnityEngine;
using System.Collections;
public class Spawn : MonoBehaviour {
public Transform prefab;
public IEnumerator Awake() {
Instantiate(prefab);
yield return new WaitForSeconds(5);
}
}
using UnityEngine;
using System.Collections;
public class Spawn : MonoBehaviour {
public Transform prefab;
public IEnumerator Do() {
yield return new WaitForSeconds(5);
// code to be executed after 5 secs
}
public void Awake() {
Instantiate(prefab);
yield return StartCoroutine("Do");
}
}