How to check if a touch down or mouse down is over UI first?

For example, I have a script which is a 3d carousel that can be span by onMouseDown and onMouseMove events tied together, and also onTouchStart and onTouchMove. I want to know if the user has clicked on some UI first before deciding what to do with those events - ie. not rotate the carousel if they click a button or drag something else like UI

Original Post on Discord

by user 103054507105067008

The EventSystem has a property “hasActiveUI” that you should be able to use. You can also take a look at OrbitControls ca. ~line 185 for how it checks that

Sorry for the delay in responding here!