I can’t seem to activate the Death Message in my game when my player dies. I want the message to display for 5 seconds and then disappear, unfortunately I am not getting any error messages so I don’t know what it wrong. Here is my code:
using UnityEngine;
using System.Collections;
public class FallDeath : MonoBehaviour {
private int scene;
public GameObject DeathMessage;
void OnTriggerEnter(Collider other) {
scene = Application.loadedLevel;
Debug.Log ("Triggered");
if (other.gameObject.name == "FPSController") {
DeathMessage.SetActive(true);
Debug.Log("Activated");
System.Threading.Thread.Sleep(5000);
DeathMessage.SetActive(false);
Debug.Log("Deactivated");
Application.LoadLevel(scene);
}
}
}