close game unity code example
Example 1: application.stop unity
using UnityEngine;
using System.Collections;
{
void Update()
{
if (Input.GetKey("escape"))
{
Application.Quit();
}
}
}
Example 2: unity how to close game
Application.Quit();
Example 3: exit game unity
Application.Quit();
Example 4: unity exit script
public static class AppHelper
{
#if UNITY_WEBPLAYER
public static string webplayerQuitURL = "http://google.com";
#endif
public static void Quit()
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#elif UNITY_WEBPLAYER
Application.OpenURL(webplayerQuitURL);
#else
Application.Quit();
#endif
}
}