I’ve been messing around with combinations of OnMouseDown and OnMouseUp and I can’t see to figure out a way to make sure a click both starts and ends within the bounds of the objects collider.
Does anyone have a quick solution for this?
I’ve been messing around with combinations of OnMouseDown and OnMouseUp and I can’t see to figure out a way to make sure a click both starts and ends within the bounds of the objects collider.
Does anyone have a quick solution for this?
In the UI you could implement IPointerClickHandler. Not sure how things differ outside the UI.
It seems to work outside of the ui, though I’m having some issues implementing it. I think this is the solution though.
How about OnMouseUpAsButton?
It also looks like there are OnMouseEnter and OnMouseExit functions, so you could presumably combine those with Down and Up to build your own click event.
Im building with intent on swapping to mobile at some point so I’m trying to stay away from any hover functions
I think I’m going to go with your original proposal and use the event system, I just need to figure out how to convert all my other mouse functions to it as well so there isn’t conflicts.
My previous tests with PointerEnter/Exit events (in the UI layer) indicate that they are triggered by touchscreen taps. (Lifting your finger counts as an Exit.) Wouldn’t surprise me if the MouseEnter/Exit functions did the same.