Windows Standalone Executable

If I create a Windows Standalone executable and run it full screen, how do I close it without having to resort to the Task Manager?

Well, you should write a script, implement a GUI or so, but, i know what you mean :wink: : just use Alt+F4 to close the app 8)

Thanks, when I learn how to implement a GUI I will have to do something like that, until then, Alt F4 will have to do. I suppose that keyboard shortcut is somewhere in one of the scripts so I could edit it myself, right?
I’m not big on too many double keys to execute commands when there are single keys free to use.

Don

Not really, Alt+F4 is just the Windows OS default shortcut to close active window :wink:

Heres a starting point

function Update(){
if(Input.GetKey("p")(Input.GetKey("right shift")))
Application.Quit();
}

You can quit using the shift and p keys together- but youd want a GUILabel or GUITexture to recieve input as a button once you press esc obviously, but its a starting snippet…

HTH
AC [/code]

Thanks for the script, I really don’t know how to implement the steps you mention though.
In Quest 3D there is an easy dialog where you can set the key for closing an executable.

136080--5003--$start_3d_scene_182.jpg

Time to start reading the scripting tutorials. :slight_smile: Its really pretty simple. Take that code Targos posted. Put it in a file called. Quit.js and then put that file on an object in your scene.

Ok, I’ll give it a try and I have been reading all the documentation I can find, well, not reading it all.
The scripting stuff is slow coming since it doesn’t hold my interest, seems too disjointed. I know it means something but it’s hard for me to concentrate on it.
This is the main reason I am moving to Unity from Quest, it has more intuitive tools for the artistic type.
I don’t want to be without the use of scripts but not have to spend as much time learning it, or at least be able to go at my own pace, which is almost non-existent sometimes. The tools in Unity help me stay interested in working in the program, though I know for more depth I will have to do my homework.

:slight_smile:

Ok, placing the script on an empty game object was simple enough and it works with your settings (P and right shift) but if I try to substitute any other keys it doesn’t work. What is the reason for this?

Quit working altogether.

Thanks,
Don

Hopefully this doesnt set you back any further.

var keyToQuit1: String;
var ModifierKey : String;
function Update(){
if(Input.GetKey(keyToQuit1)(Input.GetKey(ModifierKey)))
Application.Quit();
}

Replace Quit.js content with this, and in the inspector, you can click next to the keyToQuit slot and put x or c or whatever. And same with Modifier. You dont need two keys, but you dont want to bump one key accidently and quit either do you?

This also shows how to execute code if two varibles are returned true, which is useful.

refer to docs on INPUT/input manager etc.

But really you want a button. I recommend GUITexture. Select a texture in project go Gameobject>Create>GUITexture and add

function OnMouseDown(){
Application.Quit();
}

Do a few tutorials- It might be you’re trying to run before having a license to walk? You’ll get there sure enough…

HTH
AC

PS Untested-refer each tiny piece to docs to verify capital letters etc. if it doesnt work, and for your own understanding anyway?

heres a package. You can quit using either of the above techniques- remmember this doesnt apply in the editor or webplayer.

I had similar issues with Application.Loadlevel(); back in the day. Such a breakthrough to make it work, very satisfying.

HTH
AC

136683–5022–$quit_192.zip (32.4 KB)

Thanks for the encouragement and time, AC!
The button works great.
I tried using just the escape key (removing what I thought for the modifier key) but didn’t get it to work.
Here’s what I have for using the escape key only:

var keyToQuit1: String;
function Update(){
if(Input.GetKey(“Escape”))
Application.Quit();
}

try attaching the script to an empty gameobject :wink:

Hi David,
I tried attaching it to an empty game object but still no workie…

PS, I’ll be heading down (from Michigan) to within about 450-500 miles (Rio Hondo, Texas) of you Friday for about 6 days.

Don :slight_smile: