To begin with the user interface for our game, we need a class that manages when and how to use UI elements, such as buttons and when to show the UI screen.
In order for our other code classes to get a reference to the GameInfo
class, we can create a GameObject
in the scene that holds a GameInfo script component. To do this, perform the following steps:
In the
Assets/Scripts
folder, right-click and select Create and then click on C# Script. Name thisGameInfo
.Double-click on the
GameInfo
script and select theStart
function asAwake
. Save this file and go back to Unity.Right-click on Hierarchy and select Create Empty. Name this new GameObject
GameInfo
.With this selected, search for Inspector and click on Add Component. Then, search for GameInfo and select GameInfo.