Search Unity

Question Direct interaction with a UI instead of a XrRayInteractor

Discussion in 'XR Interaction Toolkit and Input' started by Tobias3112, Oct 13, 2020.

  1. Tobias3112

    Tobias3112

    Joined:
    May 9, 2017
    Posts:
    16
    I was wondering if there is a possibility to natively interact with UI elements using for example the Direct Indicator instead of the RayInteractor. So that you can click Buttons, Toggles etc. by "touching" them and then using the trigger on the controller.

    If the Toolkit does not provide such an interaction scheme how would you try to implement it? I was able to click Buttons with some Collider, Rigidbody and a Script that derives from "XrBaseInteractable" attached that implements the "OnSelectEnter" callback. But the problem is that this callback gets called even if the Gameobject is deactivated (is this a bug or intended?).

    Also as far as I know we can only call "OnClick" on a Button element but not something like "OnHover". So how would you try to get the usual UI events to work?
     
    unitydevelopers-greg likes this.