public static void Quit ();

参数

exitCode播放器应用程序在 Windows、Mac 和 Linux 上终止时返回的可选退出代码。默认值为 0。

描述

退出播放器应用程序。

关闭正在运行的应用程序。编辑器中将忽略退出。

**注意:**在大多数情况下,iOS 下的应用程序终止应由用户自行决定。 请参考 Apple 技术页面 qa1561 (Apple Technical Page qa1561) 以了解更多详细信息。

using UnityEngine;
using System.Collections;

// Quits the player when the user hits escape

public class ExampleClass : MonoBehaviour { void Update() { if (Input.GetKey("escape")) { Application.Quit(); } } }