Book Image

Learning Unity iOS Game Development

Book Image

Learning Unity iOS Game Development

Overview of this book

Table of Contents (14 chapters)
Learning Unity iOS Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
6
Main Menu, iAds, Leaderboards, Store Purchases, and Achievements
Index

Building the main menu UI


The main menu UI will be its own Canvas GameObject. We will then handle the main menu and the game UI via the GameInfo class. We will also use the GameInfo class to manage button presses and the iOS integration.

In Hierarchy, right-click and select UI and then click on Canvas. Name this new Canvas GameObject MenuUI.

Let's start by adding five buttons to achievements, playing, leaderboards, remove iAds, and restore purchase.

Right-click on the new MenuUI GameObject, navigate to UI, and left-click on Button. Do this four more times, so there are a total of five buttons that are children of the Menu UI GameObject.

Name the buttons and text children as follows:

  • PlayButton, PlayText

  • LeaderboardButton, LeaderboardText

  • AchievementButton, AchievementText

  • RemoveAdsButton, RemoveAdsText

  • RestorePurchaseButton, RestorePurchaseText

Adding button images

Next, we need to import the art that will be used for the main menu UI. In the Assets/UI folder, right-click and select Import New Asset...