- Home /
Detect which controller caused event on button Unity XR Plugin
So I am making a game using VR and the XR plugin unity provides and I am trying to add in haptics whenever you hover or enter into a UI element mainly a button. I know how to detect when a controller enters a button using public void OnPointerEnter(PointerEventData eventData)
I know that it is properly detecting the pointer entering the button because I had it output when called. So now I need to know which controller to buzz. I think I would have to do something with eventData.currentInputModule but I didn't really get anywhere with that. I need to get an XR.InputDevice object from the eventData pretty much.
Any help would be appreciated. Thank you!
Edit: I am basically trying to get the object that actually caused the invoke from the PointerEventData. I know that this object is stored and the variable name of it though it is private or protected. I tried debugging and looking at eventData.currentInputModule
and found a protected variable called m_RegisteredTouches that had the object that actually called the invoke but there is no way to access it. Not sure if I have hit a brick wall but any help would be greatly appreciated.
Answer by mrfossy · Mar 30 at 07:11 AM
It's been a while, but just in case somebody else stumbles upon this thread, there's a viable solution here:
Your answer

Follow this Question
Related Questions
Eventsystem requires window focus? 0 Answers
How to add haptic feedback to controller using Ovr 0 Answers
How to send mouse events directly to the canvas in world pos 0 Answers
Haptic feedback on HTC Vive controller 1 Answer
Cardboard VR App only registers raycast when finger is held down. 0 Answers