2026-05-06 15:07:56 +02:00

35 lines
732 B
C#

using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace DuloGames.UI
{
public class Demo_Quit : MonoBehaviour
{
[SerializeField] private Button m_HookToButton;
protected void OnEnable()
{
if (this.m_HookToButton != null)
this.m_HookToButton.onClick.AddListener(ExitGame);
}
protected void OnDisable()
{
if (this.m_HookToButton != null)
this.m_HookToButton.onClick.RemoveListener(ExitGame);
}
public void ExitGame()
{
#if UNITY_EDITOR
EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
}
}