Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

How too add left right touch controls c# unity in android ?

By M.K. Verma · 4 May 2022

How too add left right touch controls c# unity in android ?

eg.

var halfWidth = Screen.width / 2;

var touch = Input.GetTouch(0);
var touchPos = touch.position;

if (touchPos.x < halfWidth)
{
    Debug.Log("Left touched!");
}
else
{
    Debug.Log("Right touched!");
}