Search Unity

Question UIToolkit compatibility

Discussion in 'XR Interaction Toolkit and Input' started by seyfe, Jul 15, 2021.

  1. seyfe

    seyfe

    Joined:
    May 10, 2019
    Posts:
    74
    I made a simple scene using selection, placement, etc of AR objects. Additionally I added a button with a label showing the button-click count. When deploying to device I can use the XR Interaction Toolkit features for interacting with the environment. However, the taps on the button are not registered at all. What is the way to go for using both systems in concert?

    tl;dr;
    How can I use XR Interaction Toolkit in combination with the new UIToolkit UI system?
     
    Last edited: Jul 16, 2021
    moatdd likes this.
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,820
    Does this work with UGui? The integration code between XRI and UGui should still, hopefully, work with ui toolkit.
     
  3. seyfe

    seyfe

    Joined:
    May 10, 2019
    Posts:
    74
    I’d have to test this. Were you able to get this working with UIToolkit?
     
  4. moatdd

    moatdd

    Joined:
    Jan 13, 2013
    Posts:
    178
    Seems that ray interactors can't interact with the UIToolkit out-of-the-box. It works fine with the legacy gameobject UI system, though.

    Like, a ray interactor can sense raycast hits with a UIToolkit interface, but the events don't get passed along.
     
  5. moatdd

    moatdd

    Joined:
    Jan 13, 2013
    Posts:
    178
    from InputSystemUIInputModule.cs --
    Code (CSharp):
    1. ////FIXME: The UI is currently not reacting to pointers until they are moved after the UI module has been enabled. What needs to
    2. ////       happen is that point, trackedDevicePosition, and trackedDeviceOrientation have initial state checks. However, for touch,
    3. ////       we do *not* want to react to the initial value as then we also get presses (unlike with other pointers). Argh.
    4.  
    5. ////REVIEW: I think this would be much better served by having a composite type input for each of the three basic types of input (pointer, navigation, tracked)
    6. ////        I.e. there'd be a PointerInput, a NavigationInput, and a TrackedInput composite. This would solve several problems in one go and make
    7. ////        it much more obvious which inputs go together.
    8. ////        NOTE: This does not actually solve the problem. Even if, for example, we have a PointerInput value struct and a PointerInputComposite
    9. ////              that binds the individual inputs to controls, and then we use it to bind touch0 as a pointer input source, there may still be multiple
    10. ////              touchscreens and thus multiple touches coming in through the same composite. This leads back to the same situation.
    UIToolkit's interactions rely on Panel Event Handler and Panel Raycaster components that are added to a GameObject that is spawned at runtime and parented to your EventSystem.

    The Panel Raycaster is probably not capable of receiving raycast hits from the Tracked Device Graphic Raycaster, and the Panel Event handler might not be getting the various Pointer, Navigation, and Activation events from the XR Interaction Manager.

    This may be the unfortunate result of the UIToolkit and XR Interaction systems being developed simultaneously by separate teams -- so while they work in isolation, they do not interoperate at the present time.
     
  6. seyfe

    seyfe

    Joined:
    May 10, 2019
    Posts:
    74
    @TreyK-47 Are there any updates on this?
     
  7. VRDave_Unity

    VRDave_Unity

    Unity Technologies

    Joined:
    Nov 19, 2021
    Posts:
    275
    Hi @seyfe,
    We have not added support for UIToolkit with our XRUIInputModule. Currently we still only support UGUI. This is definitely something we'll be looking into for future releases.
     
    seyfe likes this.
  8. seyfe

    seyfe

    Joined:
    May 10, 2019
    Posts:
    74
    @VRDave_Unity @TreyK-47 As there has been no update here for a long time, I wanted to ask if this has finally been added in any version?