Learning C# 7 By Developing Games with Unity 2017 - Third Edition
by Micael DaGraça, Grzegorz Lukosek
Buttons
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:
Also, do the same for Prefabs/UI/QuitButton.prefab. After dropping the prefabs, the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access