Unity/C# Challenge 22: The Escape Function as a Feature

Alec Oney
Aug 9, 2021

Create an Escape feature within our Unity Project.

Currently, we have deployed our game without any way of exiting out after we are done playing. To implement this ability, we first have to activate our scene management, which we do by first updating our libraries:

add this to the top of our game manager script

This will allow us to access our scene management classes, fundamentally, the code we are looking for is:

to set up our script to quit when we press escape, we put this in our game manager:

At this point, we are able to quit the game when we hit the ESC key! Of note, to test this, we first need to deploy our game; we can’t see if it works from the Unity editor.

--

--