Class XRBaseInteractor
Abstract base class from which all interactor behaviours derive. This class hooks into the interaction system (via XRInteractionManager) and provides base virtual methods for handling hover and selection.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Syntax
[SelectionBase]
[DisallowMultipleComponent]
[DefaultExecutionOrder(-99)]
public abstract class XRBaseInteractor : MonoBehaviour, IXRHoverInteractor, IXRSelectInteractor, IXRInteractor
Properties
allowHover
Defines whether this interactor allows hover events.
Declaration
public bool allowHover { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
A hover exit event will still occur if this value is disabled while hovering.
allowSelect
Defines whether this interactor allows select events.
Declaration
public bool allowSelect { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
A select exit event will still occur if this value is disabled while selecting.
attachTransform
The Transform that is used as the attach point for Interactables.
Declaration
public Transform attachTransform { get; set; }
Property Value
Type | Description |
---|---|
Transform |
Remarks
Automatically instantiated and set in Awake() if null. Setting this will not automatically destroy the previous object.
enableInteractions
(Deprecated) Defines whether interactions are enabled or not.
Declaration
[Obsolete("enableInteractions has been deprecated. Use allowHover and allowSelect instead.")]
public bool enableInteractions { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
enableInteractions = value;
is a convenience property for:
allowHover = value;
allowSelect = value;
enableInteractions
has been deprecated. Use allowHover and allowSelect instead.
firstInteractableSelected
(Read Only) The first Interactable selected since not having any selection. This Interactor may not currently be selecting the Interactable, which would be the case when it was released while multiple Interactables were selected.
Declaration
public IXRSelectInteractable firstInteractableSelected { get; }
Property Value
Type | Description |
---|---|
IXRSelectInteractable |
Implements
See Also
hasHover
(Read Only) Indicates whether this Interactor is currently hovering an Interactable.
Declaration
public bool hasHover { get; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
Remarks
In other words, returns whether interactablesHovered contains any Interactables.
interactablesHovered.Count > 0
See Also
hasSelection
(Read Only) Indicates whether this Interactor is currently selecting an Interactable.
Declaration
public bool hasSelection { get; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
Remarks
In other words, returns whether interactablesSelected contains any Interactables.
interactablesSelected.Count > 0
See Also
hoverEntered
The event that is called when this Interactor begins hovering over an Interactable.
Declaration
public HoverEnterEvent hoverEntered { get; set; }
Property Value
Type | Description |
---|---|
HoverEnterEvent |
Implements
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
public HoverExitEvent hoverExited { get; set; }
Property Value
Type | Description |
---|---|
HoverExitEvent |
Implements
Remarks
The HoverExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
hoverTargets
Target Interactables that are currently being hovered over (may by empty).
Declaration
[Obsolete("hoverTargets has been deprecated. Use interactablesHovered instead.")]
protected List<XRBaseInteractable> hoverTargets { get; }
Property Value
Type | Description |
---|---|
List<XRBaseInteractable> |
Remarks
hoverTargets
has been deprecated. Use interactablesHovered instead.
See Also
interactablesHovered
(Read Only) The list of Interactables that are currently being hovered over (may by empty).
Declaration
public List<IXRHoverInteractable> interactablesHovered { get; }
Property Value
Type | Description |
---|---|
List<IXRHoverInteractable> |
Implements
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
interactablesSelected
(Read Only) The list of Interactables that are currently being selected (may by empty).
Declaration
public List<IXRSelectInteractable> interactablesSelected { get; }
Property Value
Type | Description |
---|---|
List<IXRSelectInteractable> |
Implements
Remarks
This should be treated as a read only view of the list and should not be modified by external callers. It is exposed as a List<T> rather than an IReadOnlyList<T> to avoid GC Allocations when enumerating the list.
See Also
interactionLayerMask
(Deprecated) Allows interaction with Interactables whose Interaction Layer Mask overlaps with any Layer in this Interaction Layer Mask.
Declaration
[Obsolete("interactionLayerMask has been deprecated. Use interactionLayers instead.")]
public LayerMask interactionLayerMask { get; set; }
Property Value
Type | Description |
---|---|
LayerMask |
Remarks
interactionLayerMask
has been deprecated. Use interactionLayers instead.
See Also
interactionLayers
Allows interaction with Interactables whose Interaction Layer Mask overlaps with any Layer in this Interaction Layer Mask.
Declaration
public InteractionLayerMask interactionLayers { get; set; }
Property Value
Type | Description |
---|---|
InteractionLayerMask |
Implements
See Also
interactionManager
The XRInteractionManager that this Interactor will communicate with (will find one if null).
Declaration
public XRInteractionManager interactionManager { get; set; }
Property Value
Type | Description |
---|---|
XRInteractionManager |
isHoverActive
(Read Only) Indicates whether this Interactor is in a state where it could hover.
Declaration
public virtual bool isHoverActive { get; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
isPerformingManualInteraction
Defines whether this interactor is performing a manual interaction or not.
Declaration
public bool isPerformingManualInteraction { get; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
isSelectActive
(Read Only) Indicates whether this Interactor is in a state where it could select.
Declaration
public virtual bool isSelectActive { get; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
keepSelectedTargetValid
Whether to keep selecting an Interactable after initially selecting it even when it is no longer a valid target.
Declaration
public bool keepSelectedTargetValid { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
Remarks
Return true to make the XRInteractionManager retain the selection even if the
Interactable is not contained within the list of valid targets. Return false to make
the Interaction Manager clear the selection if it isn't within the list of valid targets.
A common use for disabling this is for Ray Interactors used for teleportation to make the teleportation Interactable
no longer selected when not currently pointing at it.
onHoverEnter
(Deprecated) Gets or sets the event that Unity calls when this Interactor begins hovering over an Interactable.
Declaration
[Obsolete("onHoverEnter has been deprecated. Use onHoverEntered instead. (UnityUpgradable) -> onHoverEntered")]
public XRInteractorEvent onHoverEnter { get; }
Property Value
Type | Description |
---|---|
XRInteractorEvent |
Remarks
onHoverEnter
has been deprecated. Use onHoverEntered instead.
onHoverEntered
(Deprecated) Gets or sets the event that Unity calls when this Interactor begins hovering over an Interactable.
Declaration
[Obsolete("onHoverEntered has been deprecated. Use hoverEntered with updated signature instead.")]
public XRInteractorEvent onHoverEntered { get; set; }
Property Value
Type | Description |
---|---|
XRInteractorEvent |
Remarks
onHoverEntered
has been deprecated. Use hoverEntered with updated signature instead.
onHoverExit
(Deprecated) Gets or sets the event that Unity calls when this Interactor ends hovering over an Interactable.
Declaration
[Obsolete("onHoverExit has been deprecated. Use onHoverExited instead. (UnityUpgradable) -> onHoverExited")]
public XRInteractorEvent onHoverExit { get; }
Property Value
Type | Description |
---|---|
XRInteractorEvent |
Remarks
onHoverExit
has been deprecated. Use onHoverExited instead.
onHoverExited
(Deprecated) Gets or sets the event that Unity calls when this Interactor ends hovering over an Interactable.
Declaration
[Obsolete("onHoverExited has been deprecated. Use hoverExited with updated signature instead.")]
public XRInteractorEvent onHoverExited { get; set; }
Property Value
Type | Description |
---|---|
XRInteractorEvent |
Remarks
onHoverExited
has been deprecated. Use hoverExited with updated signature instead.
onSelectEnter
(Deprecated) Gets or sets the event that Unity calls when this Interactor begins selecting an Interactable.
Declaration
[Obsolete("onSelectEnter has been deprecated. Use onSelectEntered instead. (UnityUpgradable) -> onSelectEntered")]
public XRInteractorEvent onSelectEnter { get; }
Property Value
Type | Description |
---|---|
XRInteractorEvent |
Remarks
onSelectEnter
has been deprecated. Use onSelectEntered instead.
onSelectEntered
(Deprecated) Gets or sets the event that Unity calls when this Interactor begins selecting an Interactable.
Declaration
[Obsolete("onSelectEntered has been deprecated. Use selectEntered with updated signature instead.")]
public XRInteractorEvent onSelectEntered { get; set; }
Property Value
Type | Description |
---|---|
XRInteractorEvent |
Remarks
onSelectEntered
has been deprecated. Use selectEntered with updated signature instead.
onSelectExit
(Deprecated) Gets or sets the event that Unity calls when this Interactor ends selecting an Interactable.
Declaration
[Obsolete("onSelectExit has been deprecated. Use onSelectExited instead. (UnityUpgradable) -> onSelectExited")]
public XRInteractorEvent onSelectExit { get; }
Property Value
Type | Description |
---|---|
XRInteractorEvent |
Remarks
onSelectExit>
has been deprecated. Use onSelectExited instead.
onSelectExited
(Deprecated) Gets or sets the event that Unity calls when this Interactor ends selecting an Interactable.
Declaration
[Obsolete("onSelectExited has been deprecated. Use selectExited with updated signature instead.")]
public XRInteractorEvent onSelectExited { get; set; }
Property Value
Type | Description |
---|---|
XRInteractorEvent |
Remarks
onSelectExited
has been deprecated. Use selectExited with updated signature instead.
requireSelectExclusive
(Deprecated) (Read Only) Indicates whether this Interactor requires that an Interactable is not currently selected to begin selecting it.
Declaration
[Obsolete("requireSelectExclusive has been deprecated. Put logic in CanSelect instead.")]
public virtual bool requireSelectExclusive { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
When true, the Interaction Manager will only begin a selection when the Interactable is not currently selected.
selectedInteractableMovementTypeOverride
(Read Only) Overriding movement type of the selected Interactable's movement. By default, this does not override the movement type.
Declaration
public virtual XRBaseInteractable.MovementType? selectedInteractableMovementTypeOverride { get; }
Property Value
Type | Description |
---|---|
Nullable<XRBaseInteractable.MovementType> |
Remarks
You can use this to change the effective movement type of an Interactable for different Interactors. An example would be having an Interactable use VelocityTracking so it does not move through geometry with a Collider when interacting with it using a Ray or Direct Interactor, but have a Socket Interactor override the movement type to be Instantaneous for reduced movement latency.
See Also
selectEntered
The event that is called when this Interactor begins selecting an Interactable.
Declaration
public SelectEnterEvent selectEntered { get; set; }
Property Value
Type | Description |
---|---|
SelectEnterEvent |
Implements
Remarks
The SelectEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
selectExited
The event that is called when this Interactor ends selecting an Interactable.
Declaration
public SelectExitEvent selectExited { get; set; }
Property Value
Type | Description |
---|---|
SelectExitEvent |
Implements
Remarks
The SelectEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
selectTarget
Selected Interactable for this Interactor (may be null).
Declaration
[Obsolete("selectTarget has been deprecated. Use interactablesSelected, GetOldestInteractableSelected, hasSelection, or IsSelecting for similar functionality.")]
public XRBaseInteractable selectTarget { get; protected set; }
Property Value
Type | Description |
---|---|
XRBaseInteractable |
Remarks
selectTarget
has been deprecated. Use interactablesSelected, GetOldestInteractableSelected(IXRSelectInteractor), hasSelection, or IsSelecting(IXRSelectInteractable) instead.
See Also
startingSelectedInteractable
The Interactable that this Interactor automatically selects at startup (optional, may be null).
Declaration
public XRBaseInteractable startingSelectedInteractable { get; set; }
Property Value
Type | Description |
---|---|
XRBaseInteractable |
Methods
Awake()
See MonoBehaviour.
Declaration
protected virtual void Awake()
CanHover(IXRHoverInteractable)
Determines if the Interactable is valid for hover this frame.
Declaration
public virtual 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
CanHover(XRBaseInteractable)
Determines if the Interactable is valid for hover this frame.
Declaration
[Obsolete("CanHover(XRBaseInteractable) has been deprecated. Use CanHover(IXRHoverInteractable) instead.")]
public virtual bool CanHover(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the interactable can be hovered over this frame. |
Remarks
CanHover(XRBaseInteractable)
has been deprecated. Use CanHover(IXRHoverInteractable) instead.
See Also
CanSelect(IXRSelectInteractable)
Determines if the Interactable is valid for selection this frame.
Declaration
public virtual bool CanSelect(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the Interactable can be selected this frame. |
See Also
CanSelect(XRBaseInteractable)
Determines if the Interactable is valid for selection this frame.
Declaration
[Obsolete("CanSelect(XRBaseInteractable) has been deprecated. Use CanSelect(IXRSelectInteractable) instead.")]
public virtual bool CanSelect(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the Interactable can be selected this frame. |
Remarks
CanSelect(XRBaseInteractable)
has been deprecated. Use CanSelect(IXRSelectInteractable) instead.
See Also
CaptureAttachPose(IXRSelectInteractable)
Capture the current Attach Transform pose. This method is automatically called by Unity to capture the pose during the moment of selection.
Declaration
protected void CaptureAttachPose(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | The specific Interactable as context to get the attachment point for. |
Remarks
Unity automatically calls this method during OnSelectEntering(SelectEnterEventArgs) and should not typically need to be called by a user.
See Also
EndManualInteraction()
Ends the manually initiated selection of an Interactable.
Declaration
public virtual void EndManualInteraction()
See Also
GetAttachPoseOnSelect(IXRSelectInteractable)
Gets the world position and rotation of the Attach Transform captured during the moment of selection.
Declaration
public Pose GetAttachPoseOnSelect(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | The specific Interactable as context to get the attachment point for. |
Returns
Type | Description |
---|---|
Pose | Returns the world pose of the attachment point during the moment of selection, and otherwise the identity Pose if it was not selected during the current selection stack. |
Implements
See Also
GetAttachTransform(IXRInteractable)
Gets the Transform that is used as the attachment point for a given Interactable.
Declaration
public virtual Transform GetAttachTransform(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | The specific Interactable as context to get the attachment point for. |
Returns
Type | Description |
---|---|
Transform | Returns the attachment point Transform. |
Implements
Remarks
This should typically return the Transform of a child GameObject or the transform itself.
See Also
GetHoverTargets(List<XRBaseInteractable>)
Retrieves a copy of the list of target Interactables that are currently being hovered over.
Declaration
[Obsolete("GetHoverTargets has been deprecated. Use interactablesHovered instead.")]
public void GetHoverTargets(List<XRBaseInteractable> targets)
Parameters
Type | Name | Description |
---|---|---|
List<XRBaseInteractable> | targets | The results list to store hover targets into. |
Remarks
Clears targets
before adding to it.
GetHoverTargets
has been deprecated. Use interactablesHovered instead.
GetLocalAttachPoseOnSelect(IXRSelectInteractable)
Gets the local position and rotation of the Attach Transform captured during the moment of selection.
Declaration
public Pose GetLocalAttachPoseOnSelect(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | The specific Interactable as context to get the attachment point for. |
Returns
Type | Description |
---|---|
Pose | Returns the local pose of the attachment point during the moment of selection, and otherwise the identity Pose if it was not selected during the current selection stack. |
Implements
See Also
GetValidTargets(List<IXRInteractable>)
Retrieve the list of Interactables that this Interactor could possibly interact with this frame. This list is sorted by priority (with highest priority first).
Declaration
public virtual void GetValidTargets(List<IXRInteractable> targets)
Parameters
Type | Name | Description |
---|---|---|
List<IXRInteractable> | targets | The results list to populate with Interactables that are valid for selection or hover. |
Implements
Remarks
When implementing this method, Unity expects you to clear targets
before adding to it.
GetValidTargets(List<XRBaseInteractable>)
Retrieve the list of Interactables that this Interactor could possibly interact with this frame. This list is sorted by priority (with highest priority first).
Declaration
[Obsolete("GetValidTargets(List<XRBaseInteractable>) has been deprecated. Override GetValidTargets(List<IXRInteractable>) instead. XRInteractionManager.GetValidTargets will stitch the results together with GetValidTargets(List<IXRInteractable>), but by default this method now does nothing.")]
public virtual void GetValidTargets(List<XRBaseInteractable> targets)
Parameters
Type | Name | Description |
---|---|---|
List<XRBaseInteractable> | targets | The results list to populate with Interactables that are valid for selection or hover. |
Remarks
GetValidTargets(List<XRBaseInteractable>)
has been deprecated. Use GetValidTargets(List<IXRInteractable>) instead.
GetValidTargets(IXRInteractor, List<IXRInteractable>) will stitch the results together with GetValidTargets(List<IXRInteractable>)
,
but by default this method now does nothing.
IsHovering(IXRHoverInteractable)
Determines whether this Interactor is currently hovering the Interactable.
Declaration
public 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 |
Implements
Remarks
In other words, returns whether interactablesHovered contains interactable
.
See Also
IsHovering(IXRInteractable)
Determines whether this Interactor is currently hovering the Interactable.
Declaration
protected bool IsHovering(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | 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
IsSelecting(IXRInteractable)
Determines whether this Interactor is currently selecting the Interactable.
Declaration
protected bool IsSelecting(IXRInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
Boolean | Returns true if this Interactor is currently selecting the Interactable.
Otherwise, returns |
Remarks
In other words, returns whether interactablesSelected contains interactable
.
See Also
IsSelecting(IXRSelectInteractable)
Determines whether this Interactor is currently selecting the Interactable.
Declaration
public bool IsSelecting(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
Boolean | Returns true if this Interactor is currently selecting the Interactable.
Otherwise, returns |
Implements
Remarks
In other words, returns whether interactablesSelected contains interactable
.
See Also
OnDestroy()
See MonoBehaviour.
Declaration
protected virtual void OnDestroy()
OnDisable()
See MonoBehaviour.
Declaration
protected virtual void OnDisable()
OnEnable()
See MonoBehaviour.
Declaration
protected virtual void OnEnable()
OnHoverEntered(HoverEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates hovering over an Interactable in a second pass.
Declaration
protected virtual 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
OnHoverEntered(XRBaseInteractable)
(Deprecated) The XRInteractionManager calls this method when the Interactor first initiates hovering over an Interactable in a second pass.
Declaration
[Obsolete("OnHoverEntered(XRBaseInteractable) has been deprecated. Use OnHoverEntered(HoverEnterEventArgs) instead.")]
protected virtual void OnHoverEntered(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is being hovered over. |
Remarks
OnHoverEntered(XRBaseInteractable)
has been deprecated. Use OnHoverEntered(HoverEnterEventArgs) instead.
See Also
OnHoverEntering(HoverEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass.
Declaration
protected virtual 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
OnHoverEntering(XRBaseInteractable)
(Deprecated) The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass.
Declaration
[Obsolete("OnHoverEntering(XRBaseInteractable) has been deprecated. Use OnHoverEntering(HoverEnterEventArgs) instead.")]
protected virtual void OnHoverEntering(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is being hovered over. |
Remarks
OnHoverEntering(XRBaseInteractable)
has been deprecated. Use OnHoverEntering(HoverEnterEventArgs) instead.
See Also
OnHoverExited(HoverExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends hovering over an Interactable in a second pass.
Declaration
protected virtual 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
OnHoverExited(XRBaseInteractable)
(Deprecated) The XRInteractionManager calls this method when the Interactor ends hovering over an Interactable in a second pass.
Declaration
[Obsolete("OnHoverExited(XRBaseInteractable) has been deprecated. Use OnHoverExited(HoverExitEventArgs) instead.")]
protected virtual void OnHoverExited(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is no longer hovered over. |
Remarks
OnHoverExited(XRBaseInteractable)
has been deprecated. Use OnHoverExited(HoverExitEventArgs) instead.
See Also
OnHoverExiting(HoverExitEventArgs)
The XRInteractionManager calls this method right before the Interactor ends hovering over an Interactable in a first pass.
Declaration
protected virtual 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
OnHoverExiting(XRBaseInteractable)
(Deprecated) The XRInteractionManager calls this method right before the Interactor ends hovering over an Interactable in a first pass.
Declaration
[Obsolete("OnHoverExiting(XRBaseInteractable) has been deprecated. Use OnHoverExiting(HoverExitEventArgs) instead.")]
protected virtual void OnHoverExiting(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is no longer hovered over. |
Remarks
OnHoverExiting(XRBaseInteractable)
has been deprecated. Use OnHoverExiting(HoverExitEventArgs) instead.
See Also
OnRegistered(InteractorRegisteredEventArgs)
The XRInteractionManager calls this method when this Interactor is registered with it.
Declaration
protected virtual void OnRegistered(InteractorRegisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractorRegisteredEventArgs | args | Event data containing the Interaction Manager that registered this Interactor. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectEntered(SelectEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates selection of an Interactable in a second pass.
Declaration
protected virtual void OnSelectEntered(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactable that is being selected. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectEntered(XRBaseInteractable)
(Deprecated) The XRInteractionManager calls this method when the Interactor first initiates selection of an Interactable in a second pass.
Declaration
[Obsolete("OnSelectEntered(XRBaseInteractable) has been deprecated. Use OnSelectEntered(SelectEnterEventArgs) instead.")]
protected virtual void OnSelectEntered(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is being selected. |
Remarks
OnSelectEntered(XRBaseInteractable)
has been deprecated. Use OnSelectEntered(SelectEnterEventArgs) instead.
See Also
OnSelectEntering(SelectEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass.
Declaration
protected virtual void OnSelectEntering(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactable that is being selected. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectEntering(XRBaseInteractable)
(Deprecated) The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass.
Declaration
[Obsolete("OnSelectEntering(XRBaseInteractable) has been deprecated. Use OnSelectEntering(SelectEnterEventArgs) instead.")]
protected virtual void OnSelectEntering(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is being selected. |
Remarks
OnSelectEntering(XRBaseInteractable)
has been deprecated. Use OnSelectEntering(SelectEnterEventArgs) instead.
See Also
OnSelectExited(SelectExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.
Declaration
protected virtual void OnSelectExited(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactable that is no longer selected. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectExited(XRBaseInteractable)
(Deprecated) The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.
Declaration
[Obsolete("OnSelectExited(XRBaseInteractable) has been deprecated. Use OnSelectExited(SelectExitEventArgs) instead.")]
protected virtual void OnSelectExited(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is no longer selected. |
Remarks
OnSelectExited(XRBaseInteractable)
has been deprecated. Use OnSelectExited(SelectExitEventArgs) instead.
See Also
OnSelectExiting(SelectExitEventArgs)
The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass.
Declaration
protected virtual void OnSelectExiting(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactable that is no longer selected. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectExiting(XRBaseInteractable)
(Deprecated) The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass.
Declaration
[Obsolete("OnSelectExiting(XRBaseInteractable) has been deprecated. Use OnSelectExiting(SelectExitEventArgs) instead.")]
protected virtual void OnSelectExiting(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is no longer selected. |
Remarks
OnSelectExiting(XRBaseInteractable)
has been deprecated. Use OnSelectExiting(SelectExitEventArgs) instead.
See Also
OnUnregistered(InteractorUnregisteredEventArgs)
The XRInteractionManager calls this method when this Interactor is unregistered from it.
Declaration
protected virtual void OnUnregistered(InteractorUnregisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractorUnregisteredEventArgs | args | Event data containing the Interaction Manager that unregistered this Interactor. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase)
The XRInteractionManager calls this method to update the Interactor before interaction events occur. Interactors should use this method to do tasks like determine their valid targets.
Declaration
public virtual void PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Implements
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
The XRInteractionManager calls this method to update the Interactor after interaction events occur.
Declaration
public virtual void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Implements
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
Reset()
See MonoBehaviour.
Declaration
[Conditional("UNITY_EDITOR")]
protected virtual void Reset()
Start()
See MonoBehaviour.
Declaration
protected virtual void Start()
StartManualInteraction(IXRSelectInteractable)
Manually initiate selection of an Interactable.
Declaration
public virtual void StartManualInteraction(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable that is being selected. |
See Also
StartManualInteraction(XRBaseInteractable)
Manually initiate selection of an Interactable.
Declaration
[Obsolete("StartManualInteraction(XRBaseInteractable) has been deprecated. Use StartManualInteraction(IXRSelectInteractable) instead.")]
public virtual void StartManualInteraction(XRBaseInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractable | interactable | Interactable that is being selected. |
Remarks
StartManualInteraction(XRBaseInteractable)
has been deprecated. Use StartManualInteraction(IXRSelectInteractable) instead.
See Also
Events
registered
Calls the methods in its invocation list when this Interactor is registered with an Interaction Manager.
Declaration
public event Action<InteractorRegisteredEventArgs> registered
Event Type
Type | Description |
---|---|
Action<InteractorRegisteredEventArgs> |
Implements
Remarks
The InteractorRegisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
unregistered
Calls the methods in its invocation list when this Interactor is unregistered from an Interaction Manager.
Declaration
public event Action<InteractorUnregisteredEventArgs> unregistered
Event Type
Type | Description |
---|---|
Action<InteractorUnregisteredEventArgs> |
Implements
Remarks
The InteractorUnregisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
Explicit Interface Implementations
IXRHoverInteractor.CanHover(IXRHoverInteractable)
Determines if the Interactable is valid for hover this frame.
Declaration
bool IXRHoverInteractor.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. |
Implements
See Also
IXRHoverInteractor.OnHoverEntered(HoverEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates hovering over an Interactable in a second pass.
Declaration
void IXRHoverInteractor.OnHoverEntered(HoverEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverEnterEventArgs | args | Event data containing the Interactable that is being hovered over. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRHoverInteractor.OnHoverEntering(HoverEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass.
Declaration
void IXRHoverInteractor.OnHoverEntering(HoverEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverEnterEventArgs | args | Event data containing the Interactable that is being hovered over. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRHoverInteractor.OnHoverExited(HoverExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends hovering over an Interactable in a second pass.
Declaration
void IXRHoverInteractor.OnHoverExited(HoverExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverExitEventArgs | args | Event data containing the Interactable that is no longer hovered over. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRHoverInteractor.OnHoverExiting(HoverExitEventArgs)
The XRInteractionManager calls this method right before the Interactor ends hovering over an Interactable in a first pass.
Declaration
void IXRHoverInteractor.OnHoverExiting(HoverExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverExitEventArgs | args | Event data containing the Interactable that is no longer hovered over. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRInteractor.OnRegistered(InteractorRegisteredEventArgs)
The XRInteractionManager calls this method when this Interactor is registered with it.
Declaration
void IXRInteractor.OnRegistered(InteractorRegisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractorRegisteredEventArgs | args | Event data containing the Interaction Manager that registered this Interactor. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRInteractor.OnUnregistered(InteractorUnregisteredEventArgs)
The XRInteractionManager calls this method when this Interactor is unregistered from it.
Declaration
void IXRInteractor.OnUnregistered(InteractorUnregisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractorUnregisteredEventArgs | args | Event data containing the Interaction Manager that unregistered this Interactor. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRSelectInteractor.CanSelect(IXRSelectInteractable)
Determines if the Interactable is valid for selection this frame.
Declaration
bool IXRSelectInteractor.CanSelect(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the interactable can be selected this frame. |
Implements
See Also
IXRSelectInteractor.OnSelectEntered(SelectEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates selection of an Interactable in a second pass.
Declaration
void IXRSelectInteractor.OnSelectEntered(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactable that is being selected. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRSelectInteractor.OnSelectEntering(SelectEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass.
Declaration
void IXRSelectInteractor.OnSelectEntering(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactable that is being selected. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRSelectInteractor.OnSelectExited(SelectExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.
Declaration
void IXRSelectInteractor.OnSelectExited(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactable that is no longer selected. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRSelectInteractor.OnSelectExiting(SelectExitEventArgs)
The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass.
Declaration
void IXRSelectInteractor.OnSelectExiting(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactable that is no longer selected. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.