I created a coroutine with a debug.log so I would know the program is reading the user input and it seems that it is and the 10 second cooldown in the form of WaitForSeconds is also working for the Debug.Log but none of the methods inside are being called. All of the methods work on their own as they are already functioning in the game in other areas. The only time they don’t respond is within a coroutine where I require user input even though the Debug.Log is saying that the user input is being read.
IEnumerator Powerbomb () {
if (Input.GetKeyDown (KeyCode.Space)) {
//Calls a pre-tested method that spawns a explosion particle before the gameobject is destroyed below
SpawnParticle ();
//Destroys all gameobjects with this script once the spacebar is pressed
Destroy (this.gameObject);
// Calls a pre-tested method to add points to scoreboard
AddToTheScore ();
// Debug line to ensure the if statement is working when the Methods aren't
Debug.Log ("worked");
// Trying to give the ability a cooldown using a WaitForSeconds of 10 to test.
yield return new WaitForSeconds (10);
}
}