首页 > 其他 > 详细

unity实现二次退出提示

时间:2014-09-09 12:02:08      阅读:315      评论:0      收藏:0      [点我收藏+]

//实际项目中可以直接用GUI插件做个退出提示框。美观又和谐。

public float uTime = 2;
void OnGUI()
{
    if (uTime < 2)
  {
     GUI.Label(new Rect(Screen.width/2-50,Screen.height/2-50,100,40),"再按一次退出");
     uTime -= Time.deltaTime;
     if (uTime < 0)
    {
       uTime = 2;
    }
    if (Input.GetKeyDown(KeyCode.Escape))
       {
      Application.Quit();
       }
  }
   if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Home))
    {
    uTime -= Time.deltaTime;
  }
}

unity实现二次退出提示

原文:http://www.cnblogs.com/sling/p/3961959.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!