Search Unity

Resolved XR Interactor and XR Interactable Troubleshooting

Discussion in 'VR' started by PaulTapper, Apr 4, 2021.

  1. PaulTapper

    PaulTapper

    Joined:
    Nov 25, 2020
    Posts:
    3
    Hi

    I've just spent ages trying to get my XR Interactors and XR Interactables working together nicely in my Oculus Quest 2 game so I thought I'd post some of the gotchas that had me stumped for hours in case it helps anyone else...

    1. On the Oculus Quest 2, I found I had to create an XR -> Device Based -> Direct Interactor / Ray Interactor, not an XR -> Direct Interactor / Ray Interactor. (maybe I was doing something wrong)
    2. My XR Ray Interactor was not registering collisions with my XR Grab Interactable because I had the collision component on the XR Grab Interactable set to be a trigger. I was able to get it working by ticking on Raycast Trigger Interaction in the XR Ray Interactor
    3. If you don't have an XR Interaction Manager in your scene your XR interactions will not work. You need to add one and then put it into the empty slot in any of your XR Interactors or XR Interactables (new ones of these you create will find it automatically)
    4. If you XR Direct Interactor isn't working, check it has a collision component attached to it (you probably want a trigger)
    5. If your XR Grab Interactable item is not working, make sure you add an item to its list of colliders and drag a collider into the list
    6. A good way to help debugging is to create a sphere attached to your hand controller and another one attached to the grabbable, with the same radii as the colliders on them, with alpha'd textures, so you can see when they're meant to be intersecting. You could also set audio and/or haptic feedback events on your interactors for when they go into hover. You could also set hover enter and leave events on your interactables to change the debug sphere material from, say, alpha'd pink to alpha'd yellow, and then back again.
    Hope this helps someone, and if something I've posted here is actually wrong, please set me straight and I'll learn something too ;)
     
    esope, duyuehui97, mhussar and 8 others like this.
  2. bindon

    bindon

    Joined:
    May 25, 2017
    Posts:
    20
    Thank you !

    If only Unity could be bothered to produce adequate documentation !
     
  3. JG-Denver

    JG-Denver

    Joined:
    Jan 4, 2013
    Posts:
    77
    Thank you! This solved a pain issue I was having and imagine others will run into.

    The default rig uses rays by default and removing those to add direct interaction doesn't work as Unity's own course on Learn describes. If you want a collider it has to be added to the same game object as the XR Controller and cannot be a child object. Adding the from the XR create object showed the pattern that worked.
     
    Darm4n likes this.
  4. fnavarrensis

    fnavarrensis

    Joined:
    Aug 1, 2020
    Posts:
    9
    THANK YOU FOR THIS! I was completely lost, and thanks to this post I re-did my (now Device Based) Direct interactors. I copied all the childs from my originals, added the missing scripts and have them working!! Thanks again!!
     
  5. bullettrain5

    bullettrain5

    Joined:
    Apr 5, 2022
    Posts:
    1
    better documentation than unity
     
  6. LarryTheBrave

    LarryTheBrave

    Joined:
    Nov 20, 2016
    Posts:
    24
    For Oculus 2 a Device Based Interactor should be attached to each controller.
     
  7. Anthony73

    Anthony73

    Joined:
    Nov 24, 2021
    Posts:
    2
    In my case, there was an Event System with a blue megaphone icon enabled, I disabled it and enabled "XRUI Input Module (script)" in my "EventSystem" game object.
     
  8. edanduarte_unity

    edanduarte_unity

    Joined:
    Sep 6, 2020
    Posts:
    1
    The Grab Interactable fix helped me! Thanks a million!
     
  9. Armegalo

    Armegalo

    Joined:
    May 14, 2018
    Posts:
    30
    For me it was making a canvas for my UI without including a Tracked Device Graphical Raycaster
     
  10. nivS1978

    nivS1978

    Joined:
    Jan 6, 2024
    Posts:
    1
    I cannot get this to work. I mean I can grab objects and release them. But I want some script to run when released. I added a canvas with some text and in every single Interactable event I set the canvas text to a text describing the event hover entered, hover exited, Selected Entered and all of them. To see the text on the canvas change whenever i trouch the object with controllers or hands. But nothing happens. Also I can't select a method in the script I added to the object (then i could just have printed some messages to the console). Anyway Does anyone know what needs to be linked together and set? Things must be set up correct when objects can be grabbed and released, just somehow the events are not triggered.
    I tried to follow this guide: https://fistfullofshrimp.com/how-to-unity-vr-basics-2023-grabbing-objects/