Here is my code. OnPlayerDeath is an event from a different class. I tried calling it this way, and as a part of a coroutine where it would wait for 1 second then call. In both cases, the sound plays and then nothing happens. I also tried calling the event alone without it being a part of a different method and still nothing. Please let me know if anyone can help!
void OnTriggerEnter2D(Collider2D triggerCollider){
if (triggerCollider.tag == "Spike") {
for (int i = 0; i < 1; i++) {
if (OnPlayerDeath != null) {
timeToCompleteLaps = LapComplete.totalTime;
Player.moveSpeed = moveSpeed;
Destroy (gameObject);
Explosion.Play ();
Invoke ("PlayerDeath", 1);
}
}
}
}
void PlayerDeath(){
OnPlayerDeath ();
}