using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ESC : MonoBehaviour
{
private bool isDClick = false;
private float timer = 0;
public Button Quit;
private void Start()
{
Quit.onClick.AddListener(() =>
{
Debug.Log("退出程序");
ESCOnClick();
});
}
public void ESCOnClick()
{
if(isDClick)
{
Debug.Log("退出程序");
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
isDClick = true;
}
// Update is called once per frame
void Update()
{
if(isDClick)
{
timer += Time.deltaTime;
if(timer >2)
{
isDClick = false;
timer = 0;
}
}
}
}
01-16
1107
04-11
3426