You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Feel/MMTools/Tools/MMUtilities/MMApplicationQuit.cs

28 lines
638 B
C#

3 months ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MoreMountains.Tools
{
/// <summary>
/// A super simple mono you can add to an object to call its Quit method, which will force the application to quit.
/// </summary>
public class MMApplicationQuit : MonoBehaviour
{
[Header("Debug")]
[MMInspectorButton("Quit")]
public bool QuitButton;
/// <summary>
/// Forces the application to quit
/// </summary>
public virtual void Quit()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}
}
}