The Escape Button is a Feature

Objective: Exit game when user presses the escape key

I’m gonna add a feature to exit the game when the player presses the escape key. In order to do that I add the following code in the GameManager script within the Update function.

If you want to quit the game from the unity editor, you have to uncomment the line UnityEditor.EditorApplication.isPlaying = false.

And that’s all! You can exit game using the escape key.

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Weekly update from PointPay (September 13 — September 17, 2021)

#5 研究以下 UI 元件: Segmented Control,Slider,Switch,Activity Indicator View,Progress View,Page…

How to Join Twetch Using Safari on Your iPhone

Enhance Your Apple Device Management With AssetSonar’s Jamf Pro Integration

Generics in Swift

Swift. Closures

Creating a simple browser for iOS using WKWebView with Swift

SharePoint app bar and global navigation

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

Creating A Modular Powerup System in Unity

Tessellation in HDRP

How to Create a Custom Hand Painted Skybox

Adding a camera shake effect