- Home /
Check for Ui clicks
I am making a shooting game and shooting code is in update in Input.GetMouseButton()
. So every time i pause the game the shooting still happens. I have already tried to
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) { // Check if finger is over a UI element if (EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId)) { alert.text = "Touched the Ui"; return; } else { alert.text = "Touched the Screen"; } }
Where alert is basically a textField. And Pause Button is also a Ui button.
Comment