Class XRBaseInteractable
Abstract base class from which all interactable behaviors derive. This class hooks into the interaction system (via XRInteractionManager) and provides base virtual methods for handling hover, selection, and focus.
Implements
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit.Interactables
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
[MovedFrom("UnityEngine.XR.Interaction.Toolkit")]
[SelectionBase]
[DefaultExecutionOrder(-98)]
public abstract class XRBaseInteractable : MonoBehaviour, IXRActivateInteractable, IXRHoverInteractable, IXRSelectInteractable, IXRFocusInteractable, IXRInteractionStrengthInteractable, IXRInteractable, IXROverridesGazeAutoSelect
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 |
Remarks
Not to be confused with activating or deactivating a GameObject with SetActive(bool).
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
allowGazeAssistance
Enables gaze assistance with this interactable.
Declaration
public bool allowGazeAssistance { get; set; }
Property Value
Type | Description |
---|---|
bool |
allowGazeInteraction
Enables interaction with XRGazeInteractor.
Declaration
public bool allowGazeInteraction { get; set; }
Property Value
Type | Description |
---|---|
bool |
allowGazeSelect
Enables XRGazeInteractor to select this XRBaseInteractable.
Declaration
public bool allowGazeSelect { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
canFocus
Indicates whether this Interactable can be focused.
Declaration
public bool canFocus { get; }
Property Value
Type | Description |
---|---|
bool |
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> |
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 |
Remarks
Not to be confused with activating or deactivating a GameObject with SetActive(bool).
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
distanceCalculationMode
Specifies how this Interactable calculates its distance to a location, either using its Transform position, Collider position or Collider volume.
Declaration
public XRBaseInteractable.DistanceCalculationMode distanceCalculationMode { get; set; }
Property Value
Type | Description |
---|---|
XRBaseInteractable.DistanceCalculationMode |
See Also
firstFocusEntered
The event that is called only when the first Interaction Group gains focus on this Interactable as the sole focusing Interactor. Subsequent Interactors that gain focus will not cause this event to be invoked as long as any others are still focusing.
Declaration
public FocusEnterEvent firstFocusEntered { get; set; }
Property Value
Type | Description |
---|---|
FocusEnterEvent |
Remarks
The FocusEnterEventArgs 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 |
Remarks
The HoverEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
firstInteractionGroupFocusing
(Read Only) The first interaction group that is focused on this interactable since not being focused. The group may not currently be focusing this interactable, which would be the case when it released while multiple groups were focusing this interactable.
Declaration
public IXRInteractionGroup firstInteractionGroupFocusing { get; }
Property Value
Type | Description |
---|---|
IXRInteractionGroup |
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 |
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 |
Remarks
The SelectEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
focusEntered
The event that is called when an Interaction group gains focus on this Interactable.
Declaration
public FocusEnterEvent focusEntered { get; set; }
Property Value
Type | Description |
---|---|
FocusEnterEvent |
Remarks
The FocusEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
focusExited
The event that is called when an Interaction group loses focus on this Interactable.
Declaration
public FocusExitEvent focusExited { get; set; }
Property Value
Type | Description |
---|---|
FocusExitEvent |
Remarks
The FocusExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
focusMode
Indicates the focus policy of an Interactable.
Declaration
public InteractableFocusMode focusMode { get; set; }
Property Value
Type | Description |
---|---|
InteractableFocusMode |
See Also
gazeTimeToSelect
Number of seconds for which an XRGazeInteractor must hover over this interactable to select it if hoverToSelect is enabled.
Declaration
public float gazeTimeToSelect { get; set; }
Property Value
Type | Description |
---|---|
float |
See Also
getDistanceOverride
Overriding callback of this object's distance calculation.
Use this to change the calculation performed in GetDistance(Vector3) without needing to create a derived class.
When a callback is assigned to this property, the GetDistance(Vector3) execution calls it to perform the
distance calculation instead of using its default calculation (specified by distanceCalculationMode in this base class).
Assign null to this property to restore the default calculation.
Declaration
public Func<IXRInteractable, Vector3, DistanceInfo> getDistanceOverride { get; set; }
Property Value
Type | Description |
---|---|
Func<IXRInteractable, Vector3, DistanceInfo> |
Remarks
The assigned callback will be invoked to calculate and return the distance information of the point on this Interactable (the first parameter) closest to the given location (the second parameter). The given location and returned distance information are in world space.
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 |
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 |
Remarks
The HoverExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
hoverFilters
The list of hover filters in this object. Used as additional hover validations for this Interactable.
Declaration
public IXRFilterList<IXRHoverFilter> hoverFilters { get; }
Property Value
Type | Description |
---|---|
IXRFilterList<IXRHoverFilter> |
Remarks
While processing hover filters, all changes to this list don't have an immediate effect. These changes are buffered and applied when the processing is finished. Calling MoveTo(T, int) in this list will throw an exception when this list is being processed.
See Also
interactionGroupsFocusing
(Read Only) The list of Interaction groups currently focusing on this Interactable (may by empty).
Declaration
public List<IXRInteractionGroup> interactionGroupsFocusing { get; }
Property Value
Type | Description |
---|---|
List<IXRInteractionGroup> |
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
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 |
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 |
interactionStrengthFilters
The list of interaction strength filters in this object. Used to modify the default interaction strength of an Interactor relative to this Interactable. This is useful for interactables that can be poked to report the depth of the poke interactor as a percentage while the poke interactor is hovering over this object.
Declaration
public IXRFilterList<IXRInteractionStrengthFilter> interactionStrengthFilters { get; }
Property Value
Type | Description |
---|---|
IXRFilterList<IXRInteractionStrengthFilter> |
Remarks
While processing interaction strength filters, all changes to this list don't have an immediate effect. These changes are buffered and applied when the processing is finished. Calling MoveTo(T, int) in this list will throw an exception when this list is being processed.
See Also
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> |
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> |
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
isFocused
(Read Only) Indicates whether this interactable is currently being focused by any interaction group.
Declaration
public bool isFocused { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
In other words, returns whether interactionGroupsFocusing contains any interaction groups.
Examples
interactionGroupsFocusing.Count > 0
See Also
isHovered
(Read Only) Indicates whether an Interactor currently hovers over this Interactable.
Declaration
public bool isHovered { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
In other words, returns whether interactorsHovering contains any interactors.
Examples
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 |
---|---|
bool |
Remarks
In other words, returns whether interactorsSelecting contains any interactors.
Examples
interactorsSelecting.Count > 0
See Also
largestInteractionStrength
The largest interaction strength value of all interactors hovering or selecting this interactable.
Declaration
public IReadOnlyBindableVariable<float> largestInteractionStrength { get; }
Property Value
Type | Description |
---|---|
IReadOnlyBindableVariable<float> |
lastFocusExited
The event that is called only when the last remaining focused Interaction group loses focus on this Interactable.
Declaration
public FocusExitEvent lastFocusExited { get; set; }
Property Value
Type | Description |
---|---|
FocusExitEvent |
Remarks
The FocusExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
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 |
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 |
Remarks
The SelectExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
overrideGazeTimeToSelect
Enables this interactable to override the hoverTimeToSelect on a XRGazeInteractor.
Declaration
public bool overrideGazeTimeToSelect { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
overrideTimeToAutoDeselectGaze
Enables this interactable to override the timeToAutoDeselect on a XRGazeInteractor.
Declaration
public bool overrideTimeToAutoDeselectGaze { get; set; }
Property Value
Type | Description |
---|---|
bool |
See Also
selectEntered
The event that is called when an Interactor begins selecting this Interactable.
Declaration
public SelectEnterEvent selectEntered { get; set; }
Property Value
Type | Description |
---|---|
SelectEnterEvent |
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 |
Remarks
The SelectExitEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
selectFilters
The list of select filters in this object. Used as additional select validations for this Interactable.
Declaration
public IXRFilterList<IXRSelectFilter> selectFilters { get; }
Property Value
Type | Description |
---|---|
IXRFilterList<IXRSelectFilter> |
Remarks
While processing select filters, all changes to this list don't have an immediate effect. These changes are buffered and applied when the processing is finished. Calling MoveTo(T, int) in this list will throw an exception when this list is being processed.
See Also
selectMode
Indicates the selection policy of an Interactable.
Declaration
public InteractableSelectMode selectMode { get; set; }
Property Value
Type | Description |
---|---|
InteractableSelectMode |
See Also
startingHoverFilters
The hover filters that this object uses to automatically populate the hoverFilters List at startup (optional, may be empty). All objects in this list should implement the IXRHoverFilter interface.
Declaration
public List<Object> startingHoverFilters { get; set; }
Property Value
Type | Description |
---|---|
List<Object> |
Remarks
To access and modify the hover filters used after startup, the hoverFilters List should be used instead.
See Also
startingInteractionStrengthFilters
The interaction strength filters that this object uses to automatically populate the interactionStrengthFilters List at startup (optional, may be empty). All objects in this list should implement the IXRInteractionStrengthFilter interface.
Declaration
public List<Object> startingInteractionStrengthFilters { get; set; }
Property Value
Type | Description |
---|---|
List<Object> |
Remarks
To access and modify the select filters used after startup, the interactionStrengthFilters List should be used instead.
See Also
startingSelectFilters
The select filters that this object uses to automatically populate the selectFilters List at startup (optional, may be empty). All objects in this list should implement the IXRSelectFilter interface.
Declaration
public List<Object> startingSelectFilters { get; set; }
Property Value
Type | Description |
---|---|
List<Object> |
Remarks
To access and modify the select filters used after startup, the selectFilters List should be used instead.
See Also
timeToAutoDeselectGaze
Number of seconds that the interactable will remain selected by a XRGazeInteractor before being automatically deselected if overrideTimeToAutoDeselectGaze is true.
Declaration
public float timeToAutoDeselectGaze { get; set; }
Property Value
Type | Description |
---|---|
float |
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. |
Remarks
If the custom reticle has an IXRInteractableCustomReticle component, this will call OnReticleAttached(XRBaseInteractable, IXRCustomReticleProvider) on it.
See Also
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. |
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. |
Remarks
This should typically return the Transform of a child GameObject or the transform itself.
See Also
GetCustomReticle(IXRInteractor)
Looks for the current custom reticle that is attached based on a specific Interactor.
Declaration
public virtual GameObject GetCustomReticle(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | Interactor that is interacting with this Interactable. |
Returns
Type | Description |
---|---|
GameObject | Returns GameObject that represents the attached custom reticle. |
See Also
GetDistance(Vector3)
Gets the distance from this Interactable to the given location.
This method uses the calculation mode configured in distanceCalculationMode.
This method can be overridden (without needing to subclass) by assigning a callback to getDistanceOverride.
To restore the previous calculation mode configuration, assign null to getDistanceOverride.
Declaration
public virtual DistanceInfo GetDistance(Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | Location in world space to calculate the distance to. |
Returns
Type | Description |
---|---|
DistanceInfo | Returns the distance information (in world space) from this Interactable to the given location. |
Remarks
This method is used by other methods and systems to calculate this Interactable distance to other objects and locations (GetDistanceSqrToInteractor(IXRInteractor)).
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 |
---|---|
float | Returns the minimum squared distance between the Interactor and this Interactable's colliders. |
Remarks
This method calls the GetDistance(Vector3) method to perform the distance calculation.
GetInteractionStrength(IXRInteractor)
Gets the interaction strength between the given interactor and this interactable.
Declaration
public float GetInteractionStrength(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The specific interactor to get the interaction strength between. |
Returns
Type | Description |
---|---|
float | Returns a value |
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. |
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 |
---|---|
bool | Returns true if hovering is valid this frame. Returns false if not. |
See Also
IsHovered(IXRHoverInteractor)
Determines whether this Interactable is currently being hovered by the Interactor.
Declaration
public bool IsHovered(IXRHoverInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRHoverInteractor | interactor | Interactor to check. |
Returns
Type | Description |
---|---|
bool | Returns true if this Interactable is currently being hovered by the Interactor. Otherwise, returns false. |
Remarks
In other words, returns whether interactorsHovering contains interactor
.
See Also
IsHovered(IXRInteractor)
Determines whether this Interactable is currently being hovered by the Interactor.
Declaration
protected bool IsHovered(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | Interactor to check. |
Returns
Type | Description |
---|---|
bool | Returns true if this Interactable is currently being hovered by the Interactor. Otherwise, returns false. |
Remarks
In other words, returns whether interactorsHovering contains interactor
.
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 |
---|---|
bool | Returns true if selection is valid this frame. Returns false if not. |
See Also
IsSelected(IXRInteractor)
Determines whether this Interactable is currently being selected by the Interactor.
Declaration
protected bool IsSelected(IXRInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | Interactor to check. |
Returns
Type | Description |
---|---|
bool | Returns true if this Interactable is currently being selected by the Interactor. Otherwise, returns false. |
Remarks
In other words, returns whether interactorsSelecting contains interactor
.
See Also
IsSelected(IXRSelectInteractor)
Determines whether this Interactable is currently being selected by the Interactor.
Declaration
public bool IsSelected(IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractor | interactor | Interactor to check. |
Returns
Type | Description |
---|---|
bool | Returns true if this Interactable is currently being selected by the Interactor. Otherwise, returns false. |
Remarks
In other words, returns whether interactorsSelecting contains interactor
.
See Also
OnActivated(ActivateEventArgs)
XRBaseInputInteractor 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
OnDeactivated(DeactivateEventArgs)
XRBaseInputInteractor 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()
OnFocusEntered(FocusEnterEventArgs)
The XRInteractionManager calls this method when the Interaction group first gains focus of an Interactable in a second pass.
Declaration
protected virtual void OnFocusEntered(FocusEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
FocusEnterEventArgs | args | Event data containing the Interaction group that is initiating the focus. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnFocusEntering(FocusEnterEventArgs)
The XRInteractionManager calls this method right before the Interaction group first gains focus of an Interactable in a first pass.
Declaration
protected virtual void OnFocusEntering(FocusEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
FocusEnterEventArgs | args | Event data containing the Interaction group that is initiating focus. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnFocusExited(FocusExitEventArgs)
The XRInteractionManager calls this method when the Interaction group loses focus of an Interactable in a second pass.
Declaration
protected virtual void OnFocusExited(FocusExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
FocusExitEventArgs | args | Event data containing the Interaction group that is losing focus. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
OnFocusExiting(FocusExitEventArgs)
The XRInteractionManager calls this method right before the Interaction group loses focus of an Interactable in a first pass.
Declaration
protected virtual void OnFocusExiting(FocusExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
FocusExitEventArgs | args | Event data containing the Interaction group that is losing focus. |
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
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
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
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
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
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
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
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
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
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
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
ProcessHoverFilters(IXRHoverInteractor)
Returns the processing value of the filters in hoverFilters for the given Interactor and this Interactable.
Declaration
protected bool ProcessHoverFilters(IXRHoverInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRHoverInteractor | interactor | The Interactor to be validated by the hover filters. |
Returns
Type | Description |
---|---|
bool | Returns true if all processed filters also return true, or if hoverFilters is empty. Otherwise, returns false. |
ProcessInteractable(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. |
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
ProcessInteractionStrength(UpdatePhase)
The XRInteractionManager calls this method to signal to update the interaction strength.
Declaration
protected virtual void ProcessInteractionStrength(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase during which this method is called. |
See Also
ProcessInteractionStrengthFilters(IXRInteractor, float)
Returns the processing value of the interaction strength filters in interactionStrengthFilters for the given Interactor and this Interactable.
Declaration
protected float ProcessInteractionStrengthFilters(IXRInteractor interactor, float interactionStrength)
Parameters
Type | Name | Description |
---|---|---|
IXRInteractor | interactor | The Interactor to process by the interaction strength filters. |
float | interactionStrength | The interaction strength before processing. |
Returns
Type | Description |
---|---|
float | Returns the modified interaction strength that is the result of passing the interaction strength through each filter. |
ProcessSelectFilters(IXRSelectInteractor)
Returns the processing value of the filters in selectFilters for the given Interactor and this Interactable.
Declaration
protected bool ProcessSelectFilters(IXRSelectInteractor interactor)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractor | interactor | The Interactor to be validated by the select filters. |
Returns
Type | Description |
---|---|
bool | Returns true if all processed filters also return true, or if selectFilters is empty. Otherwise, returns false. |
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. |
Remarks
If the custom reticle has an IXRInteractableCustomReticle component, this will call OnReticleDetaching() on it.
See Also
Reset()
See MonoBehaviour.
Declaration
[Conditional("UNITY_EDITOR")]
protected virtual void Reset()
Events
registered
Calls the methods in its invocation list when this Interactable is registered with an XRInteractionManager.
Declaration
public event Action<InteractableRegisteredEventArgs> registered
Event Type
Type | Description |
---|---|
Action<InteractableRegisteredEventArgs> |
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
Calls the methods in its invocation list when this Interactable is unregistered from an XRInteractionManager.
Declaration
public event Action<InteractableUnregisteredEventArgs> unregistered
Event Type
Type | Description |
---|---|
Action<InteractableUnregisteredEventArgs> |
Remarks
The InteractableUnregisteredEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.