- Home /
Ending the game
Hey all I want to do is have the game end when I enter a trigger box.
This is what I have
function OnTriggerEnter () {
Application.Quit();
}
However it says this doesnt work in the editor or in a web version. So what should I do?
Answer by FLASHDENMARK · May 09, 2011 at 05:04 PM
Can you use OnCollisionEnter?
function OnCollisionEnter ()
{
Application.Quit();
}
I do not know if this will work in a web version, though.
No that doesn't work either. I have this script attached to a game object with a box collider component. Thanks for the help tho.
Answer by sneftel · May 09, 2011 at 05:15 PM
Consider: what would it even mean for a web applet to quit? Would the whole web browser close?
When a game ends, generally the player will be returned to the title screen, or to the main menu. Under Unity, this would usually be done by loading the "title screen" scene.
Well in that case I would like that tab that opens when I click on the html file (that loads and plays the game) to close.
So I suppose I'm looking for a close browser script
Your answer
Follow this Question
Related Questions
End game then an Object is close to another object? 0 Answers
I can't get any collision check to work... 1 Answer
The game ends when loading a new scene. 1 Answer
how to end your game 1 Answer
how do you actually stop a game? 3 Answers