- Home /
Application.Quit
I have this error:
BCE0034: Expressions in statements must only be executed for their side-effects.
On the line of a simple:
Application.Quit;
Post the whole function. If it's an if-else statement you can't use a function with no return value in the argument.
I was going to downvote this question because of how ridiculous it is, until I realized that I too have forgotten the brackets.. $$anonymous$$ade my day lol
Answer by spinaljack · Oct 11, 2010 at 09:49 PM
Application.Quit();
http://unity3d.com/support/documentation/ScriptReference/Application.Quit.html
You need the brackets
Answer by MC HALO · Oct 12, 2010 at 02:55 AM
If your problem is still not working try this as an example
function Update(){
if(Input.GetKey("a")){
Application.Quit();
}
}
this should work :)
please do note once you create the script add it to an object, if you run the script in game as soon as you make it the application will not close. To test and see if this works you need to build your game and then test it. To do so do the following:
File > Build Setting
Once you click on Build Settings a menu will pop up from here look at the first thing called " Scenes In Build" this tells you what you are building if there is nothing there the list drop should be empty look fro your right scene and place it there and then build and run the game.
now when you run it and then press the A key the application should close :)