From now on, we will be using the term view a lot. In simple words, a view is a portion of the application's UI that is visible to the user at a particular time:
- Our simple game will contain three simple views: the Menu view, the InGame view, and the GameOver view
- Each view will contain all UI elements, such as buttons and labels
- Only one view can be displayed to the user at a time
To draw UI elements, Unity requires a game object with the Canvas
component on it. Every time we add a UI element, it will be added inside of an existing Canvas or it will create a new Canvas (inside the Hierarchy Panel
).
We will start with the Menu view, and here we will have only a Play
button. The Menu view is the first view that the user will see after they launch our game. Follow these steps:
- Create a new game object and call it
UI
. It will be a root of our UI, which means that all views and UI elements will be children of this view. This will help keep...