//this script will play a bit of audio, wait for 5 seconds, then load the level listed in the string
@script RequireComponent(AudioSource)
public var otherClip: AudioClip;
var level : String = "Scene";
function Update () {
if(Input.GetButton("B Button")){
Debug.Log("Pressed x");
audio.Play();
yield WaitForSeconds (5);
Application.LoadLevel (level);
}
if(Input.GetButton("Fire1")){
Debug.Log("Pressed left click.");
audio.Play();
yield WaitForSeconds (5);
Application.LoadLevel (level);
}
if(Input.GetButton("A Button")){
Debug.Log("Pressed z");
audio.Play();
yield WaitForSeconds (5);
Application.LoadLevel (level);
}
}
Although, it isn’t working. I’ve checked the Input Manager and these are all valid button names that work in all of the other scripts I use them for, but this script for some odd reason doesn’t work. The Console is printing Script error (Detonate): Update() can not be a coroutine. I have no clue what this means, and mostly from having little programming experience.
I know that this is more of a programming question, but I didn’t know where else to turn. Please help, and much thanks in advance. Cheers!