Book Image

Unity 5.x Game Development Blueprints

By : John P. Doran
Book Image

Unity 5.x Game Development Blueprints

By: John P. Doran

Overview of this book

<p>This book will help you to create exciting and interactive games from scratch with the Unity game development platform. We will build 7-8 action-packed games of different difficulty levels, and we’ll show you how to leverage the intuitive workflow tools and state of the art Unity rendering engine to build and deploy mobile desktop as well as console games.</p> <p>Through this book, you’ll develop a complete skillset with the Unity toolset. Using the powerful C# language, we’ll create game-specific characters and game environments. Each project will focus on key Unity features as well as game strategy development. This book is the ideal guide to help your transition from an application developer to a full-fledged Unity game developer</p>
Table of Contents (19 chapters)
Unity 5.x Game Development Blueprints
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Adding in Score/High score


Now that the game has the start and ending, let's make it so that we can gain a score whenever we hit a duck:

  1. From the Hierarchy tab, duplicate the Time Text object and rename it to Score Text. Go to the Rect Transform's Anchor Presets menu, hold down Alt + Shift, and click on the top-left option. Then, change Pos X to 10 and Pos Y to -10 to push it a bit off from the edge of the screen.

  2. Then, in the Text component, change the Horizontal alignment to the left and change the Text to Score 0.

  3. Finally, change the Outline component's Effect Distance to 1.5, -1.5:

  4. Next, we will want to duplicate the Score Text object and rename it High Score Text. From there, open up the Anchor Presets menu, hold down Alt + Shift, and click on the top-right option. Afterwards, change Pos X to -10 and Pos Y to -10.

  5. Afterwards, in the Text component, change the Text to High Score 0. Then, change the Alignment to the right side:

    Now that we have the objects created, let's add in the functionality...