This is strange. When I test my game in Unity remote this code works just fine (although the buttons, which have an Event Trigger component attached, don’t), but when I build it, it seems like no taps are detected (and the buttons work fine!). So, does anybody know why my taps are not detected on my phone (only on the built version)?
public class RotateChY : MonoBehaviour{
bool menuEnabled = true;
bool tapping = false;
[SerializeField] float rotationSpeed = 1f;
[SerializeField] GameObject chHolder;
[SerializeField] GameObject chSelectionScreen;
private void Start() {
chHolder.SetActive(true);
chSelectionScreen.SetActive(false);
}
private void Update() {
if(Input.touchCount > 0) {
Touch screenTouch = Input.GetTouch(0);
if(screenTouch.phase == TouchPhase.Moved) {
menuEnabled = false;
transform.Rotate(0, -screenTouch.deltaPosition.x * Time.deltaTime * rotationSpeed, 0);
}
else if(screenTouch.phase == TouchPhase.Ended) {
if(menuEnabled) {
openChSelectScreen(true);
} else {
menuEnabled = true;
}
}
}
}
public void openChSelectScreen(bool val) {
chHolder.SetActive(!val);
chSelectionScreen.SetActive(val);
}
}