One of the most common UI elements is a simple button. Pretty much all UI interfaces on the most commonly available Unity platforms contain buttons. The simplest interaction with a button is a click. You will now learn how to construct a button in Unity UI and call a certain method in the code when the button is clicked on.
To speed up your learning process, I have prepared ready–to–use UI elements.
Download and import MenuViewUIElements.unitypackage into your Unity project.
Unity will import a few useful assets with this package. In the Project view, find Prefabs/UI/PlayButton.prefab and drag it directly on top of the Menu Canvas, as shown here:
![](https://static.packt-cdn.com/products/9781788478922/graphics/assets/14ec4c78-a947-4988-91b3-d5f4b2995062.png)
Also, do the same for Prefabs/UI/QuitButton.prefab. After dropping the prefabs, the PLAY and Quit buttons should appear on the canvas, like this:
![](https://static.packt-cdn.com/products/9781788478922/graphics/assets/996e3f20-05df-4e4b-814a-e99ac44ceac6.png)