void Update()
{
if (Input.touchCount > 0)
{
Touch touch = Input.GetTouch(0);
if (touch.position.x > (Screen.width / 2))
{
GoRight();
}
if (touch.position.x < (Screen.width / 2))
{
GoLeft();
}
}
}
This is a script that I used in my game. Basically, touch on the side of the screen you want your cube to move to. Don’t forget to create the two GoRight/GoLeft functions.
— Ty