Book Image

Unity 2017 Mobile Game Development

By : John P. Doran
Book Image

Unity 2017 Mobile Game Development

By: John P. Doran

Overview of this book

Unity has established itself as an overpowering force for developing mobile games. If you love mobile games and want to learn how to make them but have no idea where to begin, then this book is just what you need. This book takes a clear, step-by-step approach to building an endless runner game using Unity with plenty of examples on how to create a game that is uniquely your own. Starting from scratch, you will build, set up, and deploy a simple game to a mobile device. You will learn to add touch gestures and design UI elements that can be used in both landscape and portrait mode at different resolutions. You will explore the best ways to monetize your game projects using Unity Ads and in-app purchases before you share your game information on social networks. Next, using Unity’s analytics tools you will be able to make your game better by gaining insights into how players like and use your game. Finally, you’ll learn how to publish your game on the iOS and Android App Stores for the world to see and play along.
Table of Contents (11 chapters)

Adding a score system

In order to provide incentive to players to share our game with others, we need to provide a compelling reason to do so. Some people are very competitive and wish to be the best at playing a game, challenging others to do better than them. To help with that, we can allow our players to share a score value via social media. However, to do that, we'll first need to have a scoring system. Thankfully, it's not too difficult to do that, so let's add that in real quick:

  1. Start off by opening the Gameplay.scene file located in the Assets/Scenes folder.

To show our players what their score is, we'll need to have some way to show it. In our case, the easiest way would be with a text object.

  1. From the Hierarchy window, right-click on the Canvas object and select UI | Text.
  2. Rename this object Score Text and use the Anchors Preset menu to the top...