I would like to be notified when my XR Ray Interactor (XR Interaction Tookit) press down and press up a button.
First issue: OnPointerDown & OnPointerUp are called when Button is released.
→ Actually not but I was fooled by the the Meta Quest Developer Hub logs.
Second issue: For some reason when my target is a Button when I press down the OnPointerUp event is also raised.
→ I selected another UI element on the OnPointerDown event.
Edit solution:
I managed to get the down and up event, I have 3 solutions :
- by creating a custom Button, inheriting Button Monobehaviour, and overriding OnPointerDown and OnPointerUp.
- by adding the Event trigger component.
- by subscribing to the UIInputModule.pointerDown or UIInputModule.pointerUp events.