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

The Start function


Before we get to the core of the input logic, let's first set a default value to our ActiveTouch variable. As we don't want the game to start running with ActiveTouch.Phase to be set to anything but canceled, we need to set it.

Add the following code to the Start function:

  /* Use this for initialization */
  void Start ()
  {
    ActiveTouch.Phase = TouchPhase.Canceled;
  }

Tip

By default, this would be set to TouchPhase.Began, which would cause an unwanted touch to be detected when the game loads.