- Home /
how to end your game
hey guys i want to end my game if i push in a button(game object), all i want is that when the button(game object) is pushed, that the game closes.
what i have is:
function start
{
if (input.getkeydown("j"));
application.quit;
}
but it doesnt work, what am i doing wrong??
Answer by Eric5h5 · Oct 17, 2012 at 04:28 PM
A number of things are wrong:
1) There is no built-function called "start".
2) The "Start" function only runs once anyway.
3) There is nothing called "application.quit".
4) If statements do not have semicolons after them. Semicolons are for ending a statement.
4b) Formatting code correctly will help you see errors like that...the Application.Quit() line should at least be indented, and preferably enclosed in braces, though that's optional with single lines.
Your answer
Follow this Question
Related Questions
End game when all enemies eliminated in 3rd person shooter example project? 1 Answer
The game ends when loading a new scene. 1 Answer
Button Opacity Animation Not Working 0 Answers
problem with button touch zone 0 Answers
Quit button 1 Answer