docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IXRHoverInteractable

    An interface that represents an Interactable component which Interactor components can hover over.

    Inherited Members
    IXRInteractable.registered
    IXRInteractable.unregistered
    IXRInteractable.interactionLayers
    IXRInteractable.colliders
    IXRInteractable.transform
    IXRInteractable.GetAttachTransform(IXRInteractor)
    IXRInteractable.OnRegistered(InteractableRegisteredEventArgs)
    IXRInteractable.OnUnregistered(InteractableUnregisteredEventArgs)
    IXRInteractable.ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)
    IXRInteractable.GetDistanceSqrToInteractor(IXRInteractor)
    Namespace: UnityEngine.XR.Interaction.Toolkit.Interactables
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    [MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
    public interface IXRHoverInteractable : IXRInteractable

    Properties

    firstHoverEntered

    The event that is called only when the first Interactor begins hovering over this Interactable as the sole hovering Interactor. Subsequent Interactors that begin hovering over this Interactable will not cause this event to be invoked as long as any others are still hovering.

    Declaration
    HoverEnterEvent firstHoverEntered { get; }
    Property Value
    Type Description
    HoverEnterEvent
    Remarks

    The HoverEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    lastHoverExited
    hoverEntered

    hoverEntered

    The event that is called when an Interactor begins hovering over this Interactable.

    Declaration
    HoverEnterEvent hoverEntered { get; }
    Property Value
    Type Description
    HoverEnterEvent
    Remarks

    The HoverEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    hoverExited

    hoverExited

    The event that is called when an Interactor ends hovering over this Interactable.

    Declaration
    HoverExitEvent hoverExited { get; }
    Property Value
    Type Description
    HoverExitEvent
    Remarks

    The HoverExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    hoverEntered

    interactorsHovering

    (Read Only) The list of Interactors that are hovering on this Interactable (may by empty).

    Declaration
    List<IXRHoverInteractor> interactorsHovering { get; }
    Property Value
    Type Description
    List<IXRHoverInteractor>
    Remarks

    You should treat this as a read only view of the list and should not modify it. Unity exposes this as a List<T> rather than an IReadOnlyList<T> to avoid GC Allocations when enumerating the list.

    See Also
    isHovered
    interactablesHovered

    isHovered

    (Read Only) Indicates whether an Interactor currently hovers over this Interactable.

    Declaration
    bool isHovered { get; }
    Property Value
    Type Description
    bool
    Remarks

    In other words, returns whether interactorsHovering contains any interactors.

    Examples
    interactorsHovering.Count > 0
    See Also
    interactorsHovering
    hasHover

    lastHoverExited

    The event that is called only when the last remaining hovering Interactor ends hovering over this Interactable.

    Declaration
    HoverExitEvent lastHoverExited { get; }
    Property Value
    Type Description
    HoverExitEvent
    Remarks

    The HoverExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.

    See Also
    firstHoverEntered
    hoverExited

    Methods

    IsHoverableBy(IXRHoverInteractor)

    Determines if a given Interactor can hover over this Interactable.

    Declaration
    bool IsHoverableBy(IXRHoverInteractor interactor)
    Parameters
    Type Name Description
    IXRHoverInteractor interactor

    Interactor to check for a valid hover state with.

    Returns
    Type Description
    bool

    Returns true if hovering is valid this frame. Returns false if not.

    See Also
    CanHover(IXRHoverInteractable)

    OnHoverEntered(HoverEnterEventArgs)

    The XRInteractionManager calls this method when the Interactor first initiates hovering over an Interactable in a second pass.

    Declaration
    void OnHoverEntered(HoverEnterEventArgs args)
    Parameters
    Type Name Description
    HoverEnterEventArgs args

    Event data containing the Interactor that is initiating the hover.

    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnHoverExited(HoverExitEventArgs)

    OnHoverEntering(HoverEnterEventArgs)

    The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass.

    Declaration
    void OnHoverEntering(HoverEnterEventArgs args)
    Parameters
    Type Name Description
    HoverEnterEventArgs args

    Event data containing the Interactor that is initiating the hover.

    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnHoverEntered(HoverEnterEventArgs)

    OnHoverExited(HoverExitEventArgs)

    The XRInteractionManager calls this method when the Interactor ends hovering over an Interactable in a second pass.

    Declaration
    void OnHoverExited(HoverExitEventArgs args)
    Parameters
    Type Name Description
    HoverExitEventArgs args

    Event data containing the Interactor that is ending the hover.

    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnHoverEntered(HoverEnterEventArgs)

    OnHoverExiting(HoverExitEventArgs)

    The XRInteractionManager calls this method right before the Interactor ends hovering over an Interactable in a first pass.

    Declaration
    void OnHoverExiting(HoverExitEventArgs args)
    Parameters
    Type Name Description
    HoverExitEventArgs args

    Event data containing the Interactor that is ending the hover.

    Remarks

    args is only valid during this method call, do not hold a reference to it.

    See Also
    OnHoverExited(HoverExitEventArgs)

    Extension Methods

    XRHoverInteractableExtensions.GetOldestInteractorHovering(IXRHoverInteractable)
    XRHoverInteractableExtensions.IsHoveredByLeft(IXRHoverInteractable)
    XRHoverInteractableExtensions.IsHoveredByRight(IXRHoverInteractable)

    See Also

    IXRHoverInteractor
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)