Unity XR Interaction Manager Bug?
Hi, I can't get interaction between XR Direct Interactor and interactable object XR Grab Interactable in my project. After simple set up. Create XR Rig with controller with XR Direct Interactor . Create an interactable object with XR Grab Interactable. I don't see a point of showing the Interactable and Hand Controllers in my scene because it is useless, there's almost everything in default state and to double check that I did the same thing on pre-build Unity VR beginner tutorial (yeah, it works there). After some debugging I determined this: Unity's XRDirectInteractor calls OnTriggerEnter upon reaching an interactable object. It calls TryGetInteractableForCollider with a collider from XRInteractionManager. The XRInteractionManager checks its m_ColliderToInteractableMap for this collider and returns an interactable object, BUT, this collection is empty. I have 2 interactable objects in my scene. And I saw how they are registered via RegisterInteractable in XRInteractionManager, they are added to the collection m_ColliderToInteractableMap of XRInteractionManager, but as I said earlier upon trying to actually get value from there the collection is already empty. I've checked and UnregisterInteractable does not get called so it's definitely not unregistered.
I am losing my mind, I did everything I could but I just can't figure out what the heck is going on. I thought maybe it's because of the New Input System in use, but I enabled option both in my Player settings and it still occurs.
Please, help.
Answer by stroibot · Aug 26, 2020 at 02:26 PM
Ok, I figured it out, debugging was helpful and I can clearly say that DON'T PREFAB YOUR INTERACTION MANAGER. At least it was something I did, I created an empty object and attached XR Interaction Manager to it and then used this prefab in my XR Rig prefab. Yep.
Your answer
Follow this Question
Related Questions
Unity Input and Oculus Rift with Touch Controllers in Unity 2018.3.7f1 1 Answer
Oculus Touch Joystick interaction 0 Answers
I can't access play mode with Oculus 0 Answers
Pull OVRCameraRig over RTS map via touch controller grabbing gesture 1 Answer
How to set up oculus rift in unity 3d? I really need help.. 0 Answers