Class XRBaseInteractable
Abstract base class from which all interactable 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]
[DefaultExecutionOrder(-98)]
public abstract class XRBaseInteractable : MonoBehaviour, IXRActivateInteractable, IXRHoverInteractable, IXRSelectInteractable, IXRInteractable
Properties
activated
The event that is called when the selecting Interactor activates this Interactable.
Declaration
public ActivateEvent activated { get; set; }
Property Value
Type | Description |
---|---|
ActivateEvent |
Implements
Remarks
Not to be confused with activating or deactivating a GameObject with SetActive.
This is a generic event when an Interactor wants to activate an Interactable,
such as from a trigger pull on a controller.
The ActivateEventArgs passed to each listener is only valid while the event is invoked,
do not hold a reference to it.
See Also
colliders
(Read Only) Colliders to use for interaction with this Interactable (if empty, will use any child Colliders).
Declaration
public List<Collider> colliders { get; }
Property Value
Type | Description |
---|---|
List<Collider> |
Implements
customReticle
The reticle that appears at the end of the line when valid.
Declaration
public GameObject customReticle { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
deactivated
The event that is called when an Interactor deactivates this Interactable.
Declaration
public DeactivateEvent deactivated { get; set; }
Property Value
Type | Description |
---|---|
DeactivateEvent |
Implements
Remarks
Not to be confused with activating or deactivating a GameObject with SetActive.
This is a generic event when an Interactor wants to deactivate an Interactable,
such as from a trigger release on a controller.
The DeactivateEventArgs passed to each listener is only valid while the event is invoked,
do not hold a reference to it.
See Also
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
public HoverEnterEvent firstHoverEntered { 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
firstInteractorSelecting
(Read Only) The first interactor that selected this interactable since not being selected by any interactor. The interactor may not currently be selecting this interactable, which would be the case when it released while multiple interactors were selecting this interactable.
Declaration
public IXRSelectInteractor firstInteractorSelecting { get; }
Property Value
Type | Description |
---|---|
IXRSelectInteractor |
Implements
See Also
firstSelectEntered
The event that is called only when the first Interactor begins selecting this Interactable as the sole selecting Interactor. Subsequent Interactors that begin selecting this Interactable will not cause this event to be invoked as long as any others are still selecting.
Declaration
public SelectEnterEvent firstSelectEntered { 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
hoverEntered
The event that is called when an Interactor begins hovering over this 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 an Interactor ends hovering over this 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
hoveringInteractors
(Deprecated) (Read Only) The list of interactors that are hovering on this interactable.
Declaration
[Obsolete("hoveringInteractors has been deprecated. Use interactorsHovering instead.")]
public List<XRBaseInteractor> hoveringInteractors { get; }
Property Value
Type | Description |
---|---|
List<XRBaseInteractor> |
See Also
interactionLayerMask
(Deprecated) Allows interaction with Interactors 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 Interactors 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 Interactable will communicate with (will find one if null).
Declaration
public XRInteractionManager interactionManager { get; set; }
Property Value
Type | Description |
---|---|
XRInteractionManager |
interactorsHovering
(Read Only) The list of Interactors that are hovering on this Interactable (may by empty).
Declaration
public List<IXRHoverInteractor> interactorsHovering { get; }
Property Value
Type | Description |
---|---|
List<IXRHoverInteractor> |
Implements
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
interactorsSelecting
(Read Only) The list of Interactors currently selecting this Interactable (may by empty).
Declaration
public List<IXRSelectInteractor> interactorsSelecting { get; }
Property Value
Type | Description |
---|---|
List<IXRSelectInteractor> |
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
isHovered
(Read Only) Indicates whether an Interactor currently hovers over this Interactable.
Declaration
public bool isHovered { get; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
Remarks
In other words, returns whether interactorsHovering contains any interactors.
interactorsHovering.Count > 0
See Also
isSelected
(Read Only) Indicates whether this interactable is currently being selected by any interactor.
Declaration
public bool isSelected { get; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
Remarks
In other words, returns whether interactorsSelecting contains any interactors.
interactorsSelecting.Count > 0
See Also
lastHoverExited
The event that is called only when the last remaining hovering Interactor ends hovering over this Interactable.
Declaration
public HoverExitEvent lastHoverExited { 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
lastSelectExited
The event that is called only when the last remaining selecting Interactor ends selecting this Interactable.
Declaration
public SelectExitEvent lastSelectExited { get; set; }
Property Value
Type | Description |
---|---|
SelectExitEvent |
Implements
Remarks
The SelectExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
onActivate
(Deprecated) Gets or sets the event that Unity calls when an Interactor activates this selected Interactable.
Declaration
[Obsolete("onActivate has been deprecated. Use activated with updated signature instead.")]
public XRInteractableEvent onActivate { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onActivate
has been deprecated. Use activated instead.
onDeactivate
(Deprecated) Gets or sets the event that Unity calls when an Interactor deactivates this selected Interactable.
Declaration
[Obsolete("onDeactivate has been deprecated. Use deactivated with updated signature instead.")]
public XRInteractableEvent onDeactivate { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onDeactivate
has been deprecated. Use deactivated instead.
onFirstHoverEnter
(Deprecated) Unity calls this only when the first Interactor begins hovering over this Interactable.
Declaration
[Obsolete("onFirstHoverEnter has been deprecated. Use onFirstHoverEntered instead. (UnityUpgradable) -> onFirstHoverEntered")]
public XRInteractableEvent onFirstHoverEnter { get; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onFirstHoverEnter
has been deprecated. Use onFirstHoverEntered instead.
onFirstHoverEntered
(Deprecated) Gets or sets the event that Unity calls 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
[Obsolete("onFirstHoverEntered has been deprecated. Use firstHoverEntered with updated signature instead.")]
public XRInteractableEvent onFirstHoverEntered { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onFirstHoverEntered
has been deprecated. Use firstHoverEntered with updated signature instead.
onHoverEnter
(Deprecated) Unity calls this every time an Interactor begins hovering over this Interactable.
Declaration
[Obsolete("onHoverEnter has been deprecated. Use onHoverEntered instead. (UnityUpgradable) -> onHoverEntered")]
public XRInteractableEvent onHoverEnter { get; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onHoverEnter
has been deprecated. Use onHoverEntered instead.
onHoverEntered
(Deprecated) Gets or sets the event that Unity calls when an Interactor begins hovering over this Interactable.
Declaration
[Obsolete("onHoverEntered has been deprecated. Use hoverEntered with updated signature instead.")]
public XRInteractableEvent onHoverEntered { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onHoverEntered
has been deprecated. Use hoverEntered instead.
onHoverExit
(Deprecated) Unity calls this every time an Interactor ends hovering over this Interactable.
Declaration
[Obsolete("onHoverExit has been deprecated. Use onHoverExited instead. (UnityUpgradable) -> onHoverExited")]
public XRInteractableEvent onHoverExit { get; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onHoverExit
has been deprecated. Use onHoverExited instead.
onHoverExited
(Deprecated) Gets or sets the event that Unity calls when an Interactor ends hovering over this Interactable.
Declaration
[Obsolete("onHoverExited has been deprecated. Use hoverExited with updated signature instead.")]
public XRInteractableEvent onHoverExited { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onHoverExited
has been deprecated. Use hoverExited hoverExited with updated signature instead.
onLastHoverExit
(Deprecated) Unity calls this only when the last Interactor ends hovering over this Interactable.
Declaration
[Obsolete("onLastHoverExit has been deprecated. Use onLastHoverExited instead. (UnityUpgradable) -> onLastHoverExited")]
public XRInteractableEvent onLastHoverExit { get; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onLastHoverExit
has been deprecated. Use onLastHoverExited instead.
onLastHoverExited
(Deprecated) Gets or sets the event that Unity calls only when the last remaining hovering Interactor ends hovering over this Interactable.
Declaration
[Obsolete("onLastHoverExited has been deprecated. Use lastHoverExited with updated signature instead.")]
public XRInteractableEvent onLastHoverExited { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onLastHoverExited
has been deprecated. Use lastHoverExited with updated signature instead.
onSelectCancel
(Deprecated) Unity calls this when the Interactor selecting this Interactable is disabled or destroyed.
Declaration
[Obsolete("onSelectCancel has been deprecated. Use onSelectCanceled instead. (UnityUpgradable) -> onSelectCanceled")]
public XRInteractableEvent onSelectCancel { get; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onSelectCancel
has been deprecated. Use onSelectCanceled instead.
onSelectCanceled
(Deprecated) Gets or sets the event that Unity calls when this Interactable is selected by an Interactor and either is unregistered (such as from being disabled or destroyed).
Declaration
[Obsolete("onSelectCanceled has been deprecated. Use selectExited with updated signature and check for args.isCanceled instead.")]
public XRInteractableEvent onSelectCanceled { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onSelectCanceled
has been deprecated. Use selectExited with updated signature and check for isCanceled instead.
onSelectEnter
(Deprecated) Unity calls this when an Interactor begins selecting this Interactable.
Declaration
[Obsolete("onSelectEnter has been deprecated. Use onSelectEntered instead. (UnityUpgradable) -> onSelectEntered")]
public XRInteractableEvent onSelectEnter { get; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onSelectEnter
has been deprecated. Use onSelectEntered instead.
onSelectEntered
(Deprecated) Gets or sets the event that Unity calls when an Interactor begins selecting this Interactable.
Declaration
[Obsolete("onSelectEntered has been deprecated. Use selectEntered with updated signature instead.")]
public XRInteractableEvent onSelectEntered { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onSelectEntered
has been deprecated. Use selectEntered with updated signature instead.
onSelectExit
(Deprecated) Unity calls this when an Interactor ends selecting this Interactable.
Declaration
[Obsolete("onSelectExit has been deprecated. Use onSelectExited instead. (UnityUpgradable) -> onSelectExited")]
public XRInteractableEvent onSelectExit { get; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onSelectExit
has been deprecated. Use onSelectExited instead.
onSelectExited
(Deprecated) Gets or sets the event that Unity calls when an Interactor ends selecting this Interactable.
Declaration
[Obsolete("onSelectExited has been deprecated. Use selectExited with updated signature and check for !args.isCanceled instead.")]
public XRInteractableEvent onSelectExited { get; set; }
Property Value
Type | Description |
---|---|
XRInteractableEvent |
Remarks
onSelectExited
has been deprecated. Use selectExited with updated signature and check for !
isCanceled instead.
selectEntered
The event that is called when an Interactor begins selecting this 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 an Interactor ends selecting this Interactable.
Declaration
public SelectExitEvent selectExited { get; set; }
Property Value
Type | Description |
---|---|
SelectExitEvent |
Implements
Remarks
The SelectExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
selectingInteractor
(Deprecated) The Interactor selecting this Interactable (may be null).
Declaration
[Obsolete("selectingInteractor has been deprecated. Use interactorsSelecting, GetOldestInteractorSelecting, or isSelected for similar functionality.")]
public XRBaseInteractor selectingInteractor { get; protected set; }
Property Value
Type | Description |
---|---|
XRBaseInteractor |
Remarks
Unity automatically sets this value during OnSelectEntering(SelectEnterEventArgs)
and OnSelectExiting(SelectExitEventArgs) and should not typically need to be set
by a user. The setter is langword_csharp_protected to allow for rare scenarios where a derived
class needs to control this value. Changing this value does not invoke select events.
selectingInteractor
has been deprecated. Use interactorsSelecting or isSelected instead.
See Also
selectMode
Indicates the selection policy of an Interactable.
Declaration
public InteractableSelectMode selectMode { get; set; }
Property Value
Type | Description |
---|---|
InteractableSelectMode |
Implements
See Also
Methods
AttachCustomReticle(IXRInteractor)
Attaches the custom reticle to the Interactor.
Declaration
public virtual void AttachCustomReticle(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | Interactor that is interacting with this Interactable. |
AttachCustomReticle(XRBaseInteractor)
(Deprecated) Attaches the custom reticle to the Interactor.
Declaration
[Obsolete("AttachCustomReticle(XRBaseInteractor) has been deprecated. Use AttachCustomReticle(IXRInteractor) instead.")]
public virtual void AttachCustomReticle(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is interacting with this Interactable. |
Remarks
AttachCustomReticle(XRBaseInteractor)
has been deprecated. Use AttachCustomReticle(IXRInteractor) instead.
Awake()
See MonoBehaviour.
Declaration
protected virtual void Awake()
CaptureAttachPose(IXRSelectInteractor)
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(IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractor | interactor | The specific Interactor 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
GetAttachPoseOnSelect(IXRSelectInteractor)
Gets the world position and rotation of the Attach Transform captured during the moment of selection.
Declaration
public Pose GetAttachPoseOnSelect(IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractor | interactor | The specific Interactor 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 by it during the current selection stack. |
Implements
See Also
GetAttachTransform(IXRInteractor)
Gets the Transform that serves as the attachment point for a given Interactor.
Declaration
public virtual Transform GetAttachTransform(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The specific Interactor 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
GetDistanceSqrToInteractor(IXRInteractor)
Calculates squared distance to an Interactor (based on colliders).
Declaration
public virtual float GetDistanceSqrToInteractor(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | Interactor to calculate distance against. |
Returns
Type | Description |
---|---|
Single | Returns the minimum squared distance between the Interactor and this Interactable's colliders. |
Implements
GetDistanceSqrToInteractor(XRBaseInteractor)
(Deprecated) Calculates distance squared to interactor (based on colliders).
Declaration
[Obsolete("GetDistanceSqrToInteractor(XRBaseInteractor) has been deprecated. Use GetDistanceSqrToInteractor(IXRInteractor) instead.")]
public virtual float GetDistanceSqrToInteractor(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor to calculate distance against. |
Returns
Type | Description |
---|---|
Single | Returns the minimum distance between the interactor and this interactable's colliders. |
Remarks
GetDistanceSqrToInteractor(XRBaseInteractor)
has been deprecated. Use GetDistanceSqrToInteractor(IXRInteractor) instead.
GetLocalAttachPoseOnSelect(IXRSelectInteractor)
Gets the local position and rotation of the Attach Transform captured during the moment of selection.
Declaration
public Pose GetLocalAttachPoseOnSelect(IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractor | interactor | The specific Interactor 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 by it during the current selection stack. |
Implements
See Also
IsHoverableBy(IXRHoverInteractor)
Determines if a given Interactor can hover over this Interactable.
Declaration
public virtual bool IsHoverableBy(IXRHoverInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRHoverInteractor | interactor | Interactor to check for a valid hover state with. |
Returns
Type | Description |
---|---|
Boolean | Returns true if hovering is valid this frame. Returns false if not. |
See Also
IsHoverableBy(XRBaseInteractor)
(Deprecated) Determines if this interactable can be hovered by a given interactor.
Declaration
[Obsolete("IsHoverableBy(XRBaseInteractor) has been deprecated. Use IsHoverableBy(IXRHoverInteractor) instead.")]
public virtual bool IsHoverableBy(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor to check for a valid hover state with. |
Returns
Type | Description |
---|---|
Boolean | Returns true if hovering is valid this frame. Returns false if not. |
Remarks
IsHoverableBy(XRBaseInteractor)
has been deprecated. Use IsHoverableBy(IXRHoverInteractor) instead.
See Also
IsSelectableBy(IXRSelectInteractor)
Determines if a given Interactor can select this Interactable.
Declaration
public virtual bool IsSelectableBy(IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractor | interactor | Interactor to check for a valid selection with. |
Returns
Type | Description |
---|---|
Boolean | Returns true if selection is valid this frame. Returns false if not. |
See Also
IsSelectableBy(XRBaseInteractor)
(Deprecated) Determines if a given Interactor can select this Interactable.
Declaration
[Obsolete("IsSelectableBy(XRBaseInteractor) has been deprecated. Use IsSelectableBy(IXRSelectInteractor) instead.")]
public virtual bool IsSelectableBy(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor to check for a valid selection with. |
Returns
Type | Description |
---|---|
Boolean | Returns true if selection is valid this frame. Returns false if not. |
Remarks
IsSelectableBy(XRBaseInteractor)
has been deprecated. Use IsSelectableBy(IXRSelectInteractor) instead.
See Also
OnActivate(XRBaseInteractor)
(Deprecated) The XRBaseControllerInteractor calls this method when the Interactor begins an activation event on this Interactable.
Declaration
[Obsolete("OnActivate(XRBaseInteractor) has been deprecated. Use OnActivated(ActivateEventArgs) instead.")]
protected virtual void OnActivate(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is sending the activate event. |
Remarks
OnActivate(XRBaseInteractor)
has been deprecated. Use OnActivated(ActivateEventArgs) instead.
See Also
OnActivated(ActivateEventArgs)
XRBaseControllerInteractor calls this method when the Interactor begins an activation event on this Interactable.
Declaration
protected virtual void OnActivated(ActivateEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
ActivateEventArgs | args | Event data containing the Interactor that is sending the activate event. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnDeactivate(XRBaseInteractor)
(Deprecated) The XRBaseControllerInteractor calls this method when the Interactor ends an activation event on this Interactable.
Declaration
[Obsolete("OnDeactivate(XRBaseInteractor) has been deprecated. Use OnDeactivated(DeactivateEventArgs) instead.")]
protected virtual void OnDeactivate(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is sending the deactivate event. |
Remarks
OnDeactivate(XRBaseInteractor)
has been deprecated. Use OnDeactivated(DeactivateEventArgs) instead.
See Also
OnDeactivated(DeactivateEventArgs)
XRBaseControllerInteractor calls this method when the Interactor ends an activation event on this Interactable.
Declaration
protected virtual void OnDeactivated(DeactivateEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
DeactivateEventArgs | args | Event data containing the Interactor that is sending the deactivate event. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
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 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(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method when the Interactor first initiates hovering over an Interactable in a second pass.
Declaration
[Obsolete("OnHoverEntered(XRBaseInteractor) has been deprecated. Use OnHoverEntered(HoverEnterEventArgs) instead.")]
protected virtual void OnHoverEntered(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is initiating the hover. |
Remarks
OnHoverEntered(XRBaseInteractor)
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 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(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass.
Declaration
[Obsolete("OnHoverEntering(XRBaseInteractor) has been deprecated. Use OnHoverEntering(HoverEnterEventArgs) instead.")]
protected virtual void OnHoverEntering(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is initiating the hover. |
Remarks
OnHoverEntering(XRBaseInteractor)
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 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(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method when the Interactor ends hovering over an Interactable in a second pass.
Declaration
[Obsolete("OnHoverExited(XRBaseInteractor) has been deprecated. Use OnHoverExited(HoverExitEventArgs) instead.")]
protected virtual void OnHoverExited(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is ending the hover. |
Remarks
OnHoverExited(XRBaseInteractor)
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 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(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method right before the Interactor ends hovering over an Interactable in a first pass.
Declaration
[Obsolete("OnHoverExiting(XRBaseInteractor) has been deprecated. Use OnHoverExiting(HoverExitEventArgs) instead.")]
protected virtual void OnHoverExiting(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is ending the hover. |
Remarks
OnHoverExiting(XRBaseInteractor)
has been deprecated. Use OnHoverExiting(HoverExitEventArgs) instead.
See Also
OnRegistered(InteractableRegisteredEventArgs)
The XRInteractionManager calls this method when this Interactable is registered with it.
Declaration
protected virtual void OnRegistered(InteractableRegisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractableRegisteredEventArgs | args | Event data containing the Interaction Manager that registered this Interactable. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectCanceled(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method while an Interactor selects this Interactable when either is unregistered (such as from being disabled or destroyed) in a second pass.
Declaration
[Obsolete("OnSelectCanceled(XRBaseInteractor) has been deprecated. Use OnSelectExited(SelectExitEventArgs) and check for args.isCanceled instead.")]
protected virtual void OnSelectCanceled(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is ending the selection. |
Remarks
OnSelectCanceled(XRBaseInteractor)
has been deprecated. Use OnSelectExited(SelectExitEventArgs) instead.
See Also
OnSelectCanceling(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method while this Interactable is selected by an Interactor right before either is unregistered (such as from being disabled or destroyed) in a first pass.
Declaration
[Obsolete("OnSelectCanceling(XRBaseInteractor) has been deprecated. Use OnSelectExiting(SelectExitEventArgs) and check for args.isCanceled instead.")]
protected virtual void OnSelectCanceling(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is ending the selection. |
Remarks
OnSelectCanceling(XRBaseInteractor)
has been deprecated. Use OnSelectExiting(SelectExitEventArgs) instead.
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 Interactor that is initiating the selection. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectEntered(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method when the Interactor first initiates selection of an Interactable in a second pass.
Declaration
[Obsolete("OnSelectEntered(XRBaseInteractor) has been deprecated. Use OnSelectEntered(SelectEnterEventArgs) instead.")]
protected virtual void OnSelectEntered(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is initiating the selection. |
Remarks
OnSelectEntered(XRBaseInteractor)
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 Interactor that is initiating the selection. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectEntering(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass.
Declaration
[Obsolete("OnSelectEntering(XRBaseInteractor) has been deprecated. Use OnSelectEntering(SelectEnterEventArgs) instead.")]
protected virtual void OnSelectEntering(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is initiating the selection. |
Remarks
OnSelectEntering(XRBaseInteractor)
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 Interactor that is ending the selection. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectExited(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.
Declaration
[Obsolete("OnSelectExited(XRBaseInteractor) has been deprecated. Use OnSelectExited(SelectExitEventArgs) and check for !args.isCanceled instead.")]
protected virtual void OnSelectExited(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is ending the selection. |
Remarks
OnSelectExited(XRBaseInteractor)
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 Interactor that is ending the selection. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnSelectExiting(XRBaseInteractor)
(Deprecated) The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass.
Declaration
[Obsolete("OnSelectExiting(XRBaseInteractor) has been deprecated. Use OnSelectExiting(SelectExitEventArgs) and check for !args.isCanceled instead.")]
protected virtual void OnSelectExiting(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is ending the selection. |
Remarks
OnSelectExiting(XRBaseInteractor)
has been deprecated. Use OnSelectExiting(SelectExitEventArgs) instead.
See Also
OnUnregistered(InteractableUnregisteredEventArgs)
The XRInteractionManager calls this method when this Interactable is unregistered from it.
Declaration
protected virtual void OnUnregistered(InteractableUnregisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractableUnregisteredEventArgs | args | Event data containing the Interaction Manager that unregistered this Interactable. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
ProcessInteractable(XRInteractionUpdateOrder.UpdatePhase)
The XRInteractionManager calls this method to update the Interactable.
Declaration
public virtual void ProcessInteractable(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
RemoveCustomReticle(IXRInteractor)
Removes the custom reticle from the Interactor.
Declaration
public virtual void RemoveCustomReticle(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | Interactor that is no longer interacting with this Interactable. |
RemoveCustomReticle(XRBaseInteractor)
(Deprecated) Removes the custom reticle from the Interactor.
Declaration
[Obsolete("RemoveCustomReticle(XRBaseInteractor) has been deprecated. Use RemoveCustomReticle(IXRInteractor) instead.")]
public virtual void RemoveCustomReticle(XRBaseInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
XRBaseInteractor | interactor | Interactor that is no longer interacting with this Interactable. |
Remarks
RemoveCustomReticle(XRBaseInteractor)
has been deprecated. Use RemoveCustomReticle(IXRInteractor) instead.
Reset()
See MonoBehaviour.
Declaration
[Conditional("UNITY_EDITOR")]
protected virtual void Reset()
Events
registered
Unity calls the methods in this invocation list when this Interactable is registered with an XRInteractionManager.
Declaration
public event Action<InteractableRegisteredEventArgs> registered
Event Type
Type | Description |
---|---|
Action<InteractableRegisteredEventArgs> |
Implements
Remarks
The InteractableRegisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
unregistered
Unity calls the methods in this invocation list when this Interactable is unregistered from an XRInteractionManager.
Declaration
public event Action<InteractableUnregisteredEventArgs> unregistered
Event Type
Type | Description |
---|---|
Action<InteractableUnregisteredEventArgs> |
Implements
Remarks
The InteractableUnregisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
Explicit Interface Implementations
IXRActivateInteractable.OnActivated(ActivateEventArgs)
This method is called when the Interactor begins an activation event on this Interactable.
Declaration
void IXRActivateInteractable.OnActivated(ActivateEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
ActivateEventArgs | args | Event data containing the Interactor that is sending the activate event. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRActivateInteractable.OnDeactivated(DeactivateEventArgs)
This method is called when the Interactor ends an activation event on this Interactable.
Declaration
void IXRActivateInteractable.OnDeactivated(DeactivateEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
DeactivateEventArgs | args | Event data containing the Interactor that is sending the deactivate event. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRHoverInteractable.IsHoverableBy(IXRHoverInteractor)
Determines if a given Interactor can hover over this Interactable.
Declaration
bool IXRHoverInteractable.IsHoverableBy(IXRHoverInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRHoverInteractor | interactor | Interactor to check for a valid hover state with. |
Returns
Type | Description |
---|---|
Boolean | Returns true if hovering is valid this frame. Returns false if not. |
Implements
See Also
IXRHoverInteractable.OnHoverEntered(HoverEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates hovering over an Interactable in a second pass.
Declaration
void IXRHoverInteractable.OnHoverEntered(HoverEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverEnterEventArgs | args | Event data containing the Interactor that is initiating the hover. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRHoverInteractable.OnHoverEntering(HoverEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass.
Declaration
void IXRHoverInteractable.OnHoverEntering(HoverEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverEnterEventArgs | args | Event data containing the Interactor that is initiating the hover. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRHoverInteractable.OnHoverExited(HoverExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends hovering over an Interactable in a second pass.
Declaration
void IXRHoverInteractable.OnHoverExited(HoverExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverExitEventArgs | args | Event data containing the Interactor that is ending the hover. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRHoverInteractable.OnHoverExiting(HoverExitEventArgs)
The XRInteractionManager calls this method right before the Interactor ends hovering over an Interactable in a first pass.
Declaration
void IXRHoverInteractable.OnHoverExiting(HoverExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverExitEventArgs | args | Event data containing the Interactor that is ending the hover. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRInteractable.OnRegistered(InteractableRegisteredEventArgs)
The XRInteractionManager calls this method when this Interactable is registered with it.
Declaration
void IXRInteractable.OnRegistered(InteractableRegisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractableRegisteredEventArgs | args | Event data containing the Interaction Manager that registered this Interactable. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRInteractable.OnUnregistered(InteractableUnregisteredEventArgs)
The XRInteractionManager calls this method when this Interactable is unregistered from it.
Declaration
void IXRInteractable.OnUnregistered(InteractableUnregisteredEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
InteractableUnregisteredEventArgs | args | Event data containing the Interaction Manager that unregistered this Interactable. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRSelectInteractable.IsSelectableBy(IXRSelectInteractor)
Determines if a given Interactor can select this Interactable.
Declaration
bool IXRSelectInteractable.IsSelectableBy(IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractor | interactor | Interactor to check for a valid selection with. |
Returns
Type | Description |
---|---|
Boolean | Returns true if selection is valid this frame. Returns false if not. |
Implements
See Also
IXRSelectInteractable.OnSelectEntered(SelectEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates selection of an Interactable in a second pass.
Declaration
void IXRSelectInteractable.OnSelectEntered(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactor that is initiating the selection. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRSelectInteractable.OnSelectEntering(SelectEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass.
Declaration
void IXRSelectInteractable.OnSelectEntering(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactor that is initiating the selection. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRSelectInteractable.OnSelectExited(SelectExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.
Declaration
void IXRSelectInteractable.OnSelectExited(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactor that is ending the selection. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
IXRSelectInteractable.OnSelectExiting(SelectExitEventArgs)
The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass.
Declaration
void IXRSelectInteractable.OnSelectExiting(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactor that is ending the selection. |
Implements
Remarks
args
is only valid during this method call, do not hold a reference to it.