- Home /
The question is answered, right answer was accepted
Script won't exit application.Why?
I have it so that when you hover the mouse over the text it gets smaller and when you click the text the application will exit if isQuit is checked in unity. It won't work though. Please help!
using UnityEngine; using System.Collections;
public class MainMenu : MonoBehaviour
{
public bool isQuit;
void OnMouseEnter()
{
transform.localScale = new Vector3 (.085f,.085f, .085f);
}
void OnMouseExit()
{
transform.localScale = new Vector3 (.1f, .1f, .1f);
}
void OnMouseUp()
{
if (isQuit == true) {
Application.Quit ();
}
}
Answer by Vunpac · Jan 09, 2014 at 11:48 PM
are you trying to test it within the editor? if you are running the app via the editor it will now work. If you build it then run it as a stand alone program it will work.
Check the Unity Scripting Reference : http://docs.unity3d.com/Documentation/ScriptReference/Application.Quit.html
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
c# how to refresh my targeting list 2 Answers
c# how to get to idle from walk 0 Answers
Alarm lights not changing 1 Answer
What is way to flash the screen WITHOUT using a Texture? 2 Answers