Application.Quit 退出
static function Quit () : void
Description描述
Quits the player application. Quit is ignored in the editor or the web player.
退出应用程序。在编辑器或者web播放器中退出被忽略。
IMPORTANT: This function has no effect on iPhone. Termination of application under iPhone OS should be left at the user discretion. Consult Apple's Technical Q&A qa1561 page for further details: http://developer.apple.com/iphone/library/qa/qa2008/qa1561.html
这个函数对iPhone没有效果,根据iPhone应用程序终止操作系统应让用户自行决定。咨询苹果的技术问答 http://developer.apple.com/iphone/library/qa/qa2008/qa1561.html
C#
JavaScript
using UnityEngine;using System.Collections;public class example : MonoBehaviour {void Update() {if (Input.GetKey("escape"))Application.Quit();}}
// Quits the player when the user hits escape//当用户点击Esc建时退出播放器function Update () {if (Input.GetKey ("escape")) {Application.Quit();}}