Created
March 24, 2020 03:44
-
-
Save beardordie/a353f2d675f45977f2c6259400919a79 to your computer and use it in GitHub Desktop.
Unity - Press F10 to Quit, or stop playing in the Editor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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