- Home /
Question by
unity_217FBB2857DE05CBC8D2 · Jan 19 at 09:14 AM ·
c#unity 5unityeditorunity remote
Unity Build not taking touch input. Game works fine in Unity Remote
My android game is working fine in Unity Remote and all the touch controls are fine. But upon building, the game is not taking any input. The screen is not frozen, the sound and character animations are working fine. But no input is taken. It's not responding to any touch input even though it works fine in Remote. I've used the new input system and I've with both Input.GetTouch() and Input.touches(). void GetTouchInput() {
for (int i = 0; i < Input.touchCount; i++)
{
//Touch t = Input.GetTouch(i);
Touch t = Input.touches[i];
switch (t.phase)
{
case TouchPhase.Began:
if (t.position.x < oneThirdScreenWidth && leftFingerID == -1 && middleFingerID == -1)
{
leftFingerID = t.fingerId;
moveTouchStartposition = t.position;
}
else if (t.position.x > 2 * oneThirdScreenWidth && rightFingerID == -1 && middleFingerID ==-1)
{
rightFingerID = t.fingerId;
}
else if (t.position.x > oneThirdScreenWidth && rightFingerID == -1 && leftFingerID ==-1)
{
middleFingerID = t.fingerId;
}
break;
case TouchPhase.Ended:
case TouchPhase.Canceled:
if (t.fingerId == leftFingerID)
{
leftFingerID = -1;
}
else if (t.fingerId == rightFingerID)
{
rightFingerID = -1;
}
else if (t.fingerId == middleFingerID)
{
middleFingerID = -1;
}
break;
case TouchPhase.Moved:
if (t.fingerId == rightFingerID)
{
lookInput = t.deltaPosition * cameraSensitivity * Time.deltaTime;
}
else if (t.fingerId == leftFingerID)
{
moveInput = t.position - moveTouchStartposition;
}
break;
case TouchPhase.Stationary:
if (t.fingerId == rightFingerID)
{
lookInput = Vector2.zero;
}
else if (t.fingerId == middleFingerID && Time.time >= timeToFire)
{
timeToFire = Time.time + 1 / fireRate;
fpsShooter.Shoot();
reticle.SetMaxSize();
}
break;
}
}
}
This is my player settings:
screenshot-2022-01-19-143344.png
(87.0 kB)
screenshot-2022-01-19-143425.png
(98.0 kB)
Comment