add ESC exit handler

This commit is contained in:
2026-05-10 22:07:21 +02:00
parent 28e64b58e9
commit 9c83f36d5d
2 changed files with 23 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
using UnityEngine;
public class ExitHandles : MonoBehaviour
{
private void FixedUpdate()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
QuitGame();
}
}
private void QuitGame()
{
Application.Quit();
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#endif
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5384884ed8e0b864cb4f90b078206b62