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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset