I want a my game over screen to be displayed, after my player controller remains in a trigger zone for about 0.5 second. How can I do that?
Hello. First, I assume that you already know how to make your “Trigger Zone” by using “Is Trigger” on a collider. To make actions for that trigger, you must attach a script on the Is Trigger GameObject, that uses OnTriggerEnter function. Here is an example:
var triggerTime = 0; //variable for time in trigger.
var endGameTime = 5; //variable for time to end the game.
function OnTriggerEnter ( other : Collider){
if (triggerTime == endGameTime){
//Your end game action goes here. Example:
application.Load ("end game");
}
}
//Update function for time variable
function Update (){
triggerTime += 1 * Time.deltaTime;
}