Quantcast
Channel: Questions in topic: "unity remote"
Viewing all articles
Browse latest Browse all 297

Unity Build not taking touch input. Game works fine in Unity Remote

$
0
0
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: ![alt text][1] ![alt text][2] [1]: /storage/temp/191402-screenshot-2022-01-19-143344.png [2]: /storage/temp/191403-screenshot-2022-01-19-143425.png

Viewing all articles
Browse latest Browse all 297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>