title: How to use change the following code to work on a device using touch controls?
body: <p>I am using Unity and C# to create a game. The following code enables the player to move left and right by using the arrow keys on the computer, but I need it to work on an Andriod device. Is there an easy way to use this code to enable the game to work on an Andriod device by using touch controls and without rewriting all the code?</p>
  
  <pre><code>void Start()
  {
      myRigidbody = GetComponent&lt;Rigidbody2D&gt;();
      myAnim = GetComponent&lt;Animator&gt;();
  }
  
  // Update is called once per frame
  void Update()
  {
      isGrounded = Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, whatIsGround);
  
      if (Input.GetAxisRaw("Horizontal") &gt; 0f)
      {
          myRigidbody.velocity = new Vector3(moveSpeed, 
          myRigidbody.velocity.y, 0);
      }
      else if (Input.GetAxisRaw("Horizontal") &lt; 0f)
      {
          myRigidbody.velocity = new Vector3(-moveSpeed, 
          myRigidbody.velocity.y, 0f);
      }
      else
      {
          myRigidbody.velocity = new Vector3(0f, myRigidbody.velocity.y,0f);
      }
  
      if (Input.GetButtonDown("Jump") &amp;&amp; isGrounded)
      {
          myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, jumpSpeed, 0f);
      }
  
      myAnim.SetFloat("Speed", Mathf.Abs(myRigidbody.velocity.x));
      myAnim.SetBool("Grounded", isGrounded);
      }
  }
  </code></pre>