Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Hover events for UI using Ray or Direct Interactor

Discussion in 'XR Interaction Toolkit and Input' started by kumelo01, Mar 18, 2022.

  1. kumelo01

    kumelo01

    Joined:
    Apr 11, 2020
    Posts:
    1
    Hi everyone! I am looking to get Hover events working for the UI when the users hover over a button for a bit using the Ray Interactor. If anyone has a way to work this it would be appreciated.
     
  2. langokalla

    langokalla

    Joined:
    Aug 4, 2020
    Posts:
    22
    On the same game object you have your Button on, you can add an Event Trigger component. After adding this component,expand it and click the "Add New Event Type". You will need to add the OnPointerEnter event. Now you can use that event like any other event in the inspector. This event will trigger when a Pointer enters the button object, which in better words is the exact same as when your XRRayInteractor will "start hovering" the UI. Use the OnPointerExit as the "end hovering" event if that is desirable. This component has a bunch of other events to play with also.
    EventTrigger.PNG
     
    unity_hbxVaSw7KwRBjQ likes this.
  3. amplez

    amplez

    Joined:
    Aug 19, 2018
    Posts:
    5
    And how would you know which hand hovered the UI?