Unity 关闭运行自己的exe,结束进程
/// <summary> /// 退出程序 /// </summary> void QuitProcedure() { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif }
using UnityEngine; public class CloseExe : MonoBehaviour { // Start is called before the first frame update void Start() { EventTriggerListener.Get(transform.gameObject).onClick = onClick; } void onClick(GameObject sender) { QuitProcedure(); } /// <summary> /// 退出程序 /// </summary> void QuitProcedure() { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif } }
posted on 2023-06-21 10:31 zqiang0803 阅读(530) 评论(0) 编辑 收藏 举报