Interface IXRSelectInteractor
An interface that represents an Interactor component that can select an Interactable component.
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
public interface IXRSelectInteractor : IXRInteractor
Properties
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
IXRSelectInteractable firstInteractableSelected { get; }
Property Value
Type | Description |
---|---|
IXRSelectInteractable |
See Also
hasSelection
(Read Only) Indicates whether this Interactor is currently selecting an Interactable.
Declaration
bool hasSelection { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
In other words, returns whether interactablesSelected contains any Interactables.
interactablesSelected.Count > 0
See Also
interactablesSelected
(Read Only) The list of Interactables that are currently being selected (may by empty).
Declaration
List<IXRSelectInteractable> interactablesSelected { get; }
Property Value
Type | Description |
---|---|
List<IXRSelectInteractable> |
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
isSelectActive
(Read Only) Indicates whether this Interactor is in a state where it could select.
Declaration
bool isSelectActive { get; }
Property Value
Type | Description |
---|---|
bool |
See Also
keepSelectedTargetValid
Whether to keep selecting an Interactable after initially selecting it even when it is no longer a valid target.
Declaration
bool keepSelectedTargetValid { get; }
Property Value
Type | Description |
---|---|
bool |
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.
See Also
selectEntered
The event that is called when this Interactor begins selecting an Interactable.
Declaration
SelectEnterEvent selectEntered { get; }
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 this Interactor ends selecting an Interactable.
Declaration
SelectExitEvent selectExited { get; }
Property Value
Type | Description |
---|---|
SelectExitEvent |
Remarks
The SelectEnterEventArgs passed to each listener is only valid while the event is invoked, do not hold a reference to it.
See Also
Methods
CanSelect(IXRSelectInteractable)
Determines if the Interactable is valid for selection this frame.
Declaration
bool CanSelect(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
bool | Returns true if the interactable can be selected this frame. |
See Also
GetAttachPoseOnSelect(IXRSelectInteractable)
Gets the world position and rotation of the Attach Transform captured during the moment of selection.
Declaration
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. |
See Also
GetLocalAttachPoseOnSelect(IXRSelectInteractable)
Gets the local position and rotation of the Attach Transform captured during the moment of selection.
Declaration
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. |
See Also
IsSelecting(IXRSelectInteractable)
Determines whether this Interactor is currently selecting the Interactable.
Declaration
bool IsSelecting(IXRSelectInteractable interactable)
Parameters
Type | Name | Description |
---|---|---|
IXRSelectInteractable | interactable | Interactable to check. |
Returns
Type | Description |
---|---|
bool | Returns true if this Interactor is currently selecting the Interactable.
Otherwise, returns |
Remarks
In other words, returns whether interactablesSelected contains interactable
.
See Also
OnSelectEntered(SelectEnterEventArgs)
The XRInteractionManager calls this method when the Interactor first initiates selection of an Interactable in a second pass.
Declaration
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
OnSelectEntering(SelectEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates selection of an Interactable in a first pass.
Declaration
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
OnSelectExited(SelectExitEventArgs)
The XRInteractionManager calls this method when the Interactor ends selection of an Interactable in a second pass.
Declaration
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
OnSelectExiting(SelectExitEventArgs)
The XRInteractionManager calls this method right before the Interactor ends selection of an Interactable in a first pass.
Declaration
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.