docs.unity3d.com
    Show / Hide Table of Contents

    Interface IXRHoverInteractor

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

    Inherited Members
    IXRInteractor.registered
    IXRInteractor.unregistered
    IXRInteractor.interactionLayers
    IXRInteractor.transform
    IXRInteractor.GetAttachTransform(IXRInteractable)
    IXRInteractor.GetValidTargets(List<IXRInteractable>)
    IXRInteractor.OnRegistered(InteractorRegisteredEventArgs)
    IXRInteractor.OnUnregistered(InteractorUnregisteredEventArgs)
    IXRInteractor.PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase)
    IXRInteractor.ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
    Namespace: UnityEngine.XR.Interaction.Toolkit
    Syntax
    public interface IXRHoverInteractor : IXRInteractor

    Properties

    hasHover

    (Read Only) Indicates whether this Interactor is currently hovering an Interactable.

    Declaration
    bool hasHover { get; }
    Property Value
    Type Description
    Boolean
    Remarks

    In other words, returns whether interactablesHovered contains any Interactables.

    interactablesHovered.Count > 0

    See Also
    interactablesHovered
    isHovered

    hoverEntered

    The event that is called when this Interactor begins hovering over an 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 this Interactor ends hovering over an 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

    interactablesHovered

    (Read Only) The list of Interactables that are currently being hovered over (may by empty).

    Declaration
    List<IXRHoverInteractable> interactablesHovered { get; }
    Property Value
    Type Description
    List<IXRHoverInteractable>
    Remarks

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

    See Also
    hasHover
    interactorsHovering

    isHoverActive

    (Read Only) Indicates whether this Interactor is in a state where it could hover.

    Declaration
    bool isHoverActive { get; }
    Property Value
    Type Description
    Boolean

    Methods

    CanHover(IXRHoverInteractable)

    Determines if the Interactable is valid for hover this frame.

    Declaration
    bool CanHover(IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractable interactable

    Interactable to check.

    Returns
    Type Description
    Boolean

    Returns true if the interactable can be hovered over this frame.

    See Also
    IsHoverableBy(IXRHoverInteractor)

    IsHovering(IXRHoverInteractable)

    Determines whether this Interactor is currently hovering the Interactable.

    Declaration
    bool IsHovering(IXRHoverInteractable interactable)
    Parameters
    Type Name Description
    IXRHoverInteractable interactable

    Interactable to check.

    Returns
    Type Description
    Boolean

    Returns true if this Interactor is currently hovering the Interactable. Otherwise, returns .

    Remarks

    In other words, returns whether interactablesHovered contains interactable.

    See Also
    interactablesHovered

    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 Interactable that is being hovered over.

    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 Interactable that is being hovered over.

    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 Interactable that is no longer hovered over.

    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 Interactable that is no longer hovered over.

    Remarks

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

    See Also
    OnHoverExited(HoverExitEventArgs)

    Extension Methods

    XRHoverInteractorExtensions.GetOldestInteractableHovered(IXRHoverInteractor)

    See Also

    IXRHoverInteractable
    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023