unity call when quit code example
Example 1: application.stop unity
using UnityEngine;
using System.Collections;// Quits the player when the user hits escapepublic class ExampleClass : MonoBehaviour
{
void Update()
{
if (Input.GetKey("escape"))
{
Application.Quit();
}
}
}
Example 2: shut game unity
public void QuitGame()
{
Application.Quit();
}