Interface IXRHoverInteractable
An interface that represents an Interactable component which Interactor components can hover over.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
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
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
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
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
(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.
interactorsHovering.Count > 0
See Also
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
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
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
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
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
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.