Skip to content

Instantly share code, notes, and snippets.

@beardordie
Created March 24, 2020 03:44
Show Gist options
  • Save beardordie/a353f2d675f45977f2c6259400919a79 to your computer and use it in GitHub Desktop.
Save beardordie/a353f2d675f45977f2c6259400919a79 to your computer and use it in GitHub Desktop.
Unity - Press F10 to Quit, or stop playing in the Editor.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class F10ApplicationQuit : MonoBehaviour {
public KeyCode keyCode = KeyCode.F10;
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(keyCode))
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#endif
Application.Quit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment