/* Copyright 2013, Aleksander Hristov, boxcollider@gmail.com . This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ using UnityEngine; using System.Collections; //Class responsible for quitting application. Shows button in the top right corner of a screen. //Attach this script to an empty game object in scene. public class AppQuitter : MonoBehaviour { float screenScale = 0.15f; int buttonWidth; int buttonHeight; void Start () { buttonWidth = (int)(Screen.width * screenScale); buttonHeight = (int)(Screen.height * screenScale); } void OnGUI () { if (GUI.Button (new Rect (Screen.width - buttonWidth, 0, buttonWidth, buttonHeight), "Quit")) { Application.Quit (); } } }
Friday, November 15, 2013
UNITY3D Quit application script
Friday, November 1, 2013
Subscribe to:
Posts (Atom)