Interface IXRHoverInteractor
An interface that represents an Interactor component that can hover over an Interactable component.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Interactors
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
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 |
---|---|
bool |
Remarks
In other words, returns whether interactablesHovered contains any Interactables.
Examples
interactablesHovered.Count > 0
See Also
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
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
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
isHoverActive
(Read Only) Indicates whether this Interactor is in a state where it could hover.
Declaration
bool isHoverActive { get; }
Property Value
Type | Description |
---|---|
bool |
See Also
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 |
---|---|
bool | Returns true if the interactable can be hovered over this frame. |
See Also
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 |
---|---|
bool | Returns true if this Interactor is currently hovering the Interactable. Otherwise, returns false. |
Remarks
In other words, returns whether interactablesHovered contains interactable
.
See Also
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
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
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
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.