title: Adding touch controls to character controller? Unity2d
body: <p>Got this simple character controller that moves my platformer character left and right with a flip.</p>
  
  <p>Was hoping someone could integrate or show me how to add in touch controls for android/ios.</p>
  
  <p>Just a simple touch left side of screen to go left and right side to go right.</p>
  
  <p>Thanks</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class RobotController : MonoBehaviour {
  //This will be our maximum speed as we will always be multiplying by 1
  public float maxSpeed = 2f;
  //a boolean value to represent whether we are facing left or not
  bool facingRight = false;
  //a value to represent our Animator
  Animator anim;
  // Use this for initialization
  void Start () {
      //set anim to our animator
      anim = GetComponent&lt;Animator&gt;();
  
  }
  
  // Update is called once per frame
  void FixedUpdate () {
  
      float move = Input.GetAxis ("Horizontal");//Gives us of one if we are moving via the arrow keys
      //move our Players rigidbody
      rigidbody2D.velocity = new Vector3 (move * maxSpeed, rigidbody2D.velocity.y);
      //set our speed
      anim.SetFloat ("Speed",Mathf.Abs (move));
      //if we are moving left but not facing left flip, and vice versa
      if (move &lt; 0 &amp;&amp; !facingRight) {
  
          Flip ();
      } else if (move &gt; 0 &amp;&amp; facingRight) {
          Flip ();
      }
  }
  
  //flip if needed
  void Flip(){
      facingRight = !facingRight;
      Vector3 theScale = transform.localScale;
      theScale.x *= -1;
      transform.localScale = theScale;
  }
  }
  </code></pre>