标签:style blog class code c java
1
2
3
4 |
void Update () {<br> if (Input.GetKey(KeyCode.Escape))<br>{ Application.Quit();<br> }<br>} |
//按两次返回退出程序
float _waitTime = 2f;//前后两次按退出间隔时间
if (_waitTime < 2) { GUI.Label(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 30, 200, 60), "再按一次退出"); _waitTime -= Time.deltaTime; if (_waitTime < 0) { _waitTime = 2; } if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } } if (Input.GetKeyUp(KeyCode.Escape) && _waitTime == 2) { _waitTime -= Time.deltaTime; }
Unity 3D 监听键盘 返回键退出程序C#,布布扣,bubuko.com
标签:style blog class code c java
原文地址:http://www.cnblogs.com/dawn-cn/p/3733614.html