Touch Under UI

how can i stop objects under UI (Buttons / Canvas) Getting Pressed (Touch) on Devices

There’s “EventSystem.current.IsPointerOverGameObject()” function, which you could use to make sure you do not respond to clicks when there’s an UI element under the click/touch.

https://docs.unity3d.com/Packages/com.unity.ugui@1.0/api/UnityEngine.EventSystems.EventSystem.html

That worked for Mouse Clicks but not for touch What should i do

It works for touch as well.

var touch = Input.GetTouch(0);
EventSystem.current.IsPointerOverGameObject(touch.fingerId)