unity3D退出游戏代码
时间: 2023-11-13 11:03:45 浏览: 169
Sure, here is an example of how you can write code to quit a Unity game:
```
using UnityEngine;
using System.Collections;
public class QuitGame : MonoBehaviour
{
// Update is called once per frame
void Update()
{
if (Input.GetKey("escape"))
{
Application.Quit();
}
}
}
```
This code checks for the user pressing the "Escape" key, and if they do, the application will quit.
阅读全文