Class XRBaseControllerInteractor
Abstract base class from which all interactors that are controller-driven derive. This class hooks into the interaction system (via XRInteractionManager) and provides base virtual methods for handling hover and selection. Additionally, this class provides functionality for checking the controller's selection status and hiding the controller on selection.
Inheritance
Inherited Members
Namespace: UnityEngine.XR.Interaction.Toolkit
Syntax
public abstract class XRBaseControllerInteractor : XRBaseInteractor, IXRHoverInteractor, IXRSelectInteractor, IXRActivateInteractor, IXRInteractor
Properties
allowActivate
Defines whether this interactor allows sending activate and deactivate events.
Declaration
public bool allowActivate { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
allowHoveredActivate
Controls whether to send activate and deactivate events to interactables that this interactor is hovered over but not selected when there is no current selection. By default, the interactor will only send activate and deactivate events to interactables that it's selected.
Declaration
public bool allowHoveredActivate { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
audioClipForOnHoverCanceled
The AudioClip Unity plays on Hover Canceled.
Declaration
public AudioClip audioClipForOnHoverCanceled { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
See Also
audioClipForOnHoverEnter
(Deprecated) The AudioClip Unity plays on Hover Entered.
Declaration
[Obsolete("audioClipForOnHoverEnter has been deprecated. Use audioClipForOnHoverEntered instead. (UnityUpgradable) -> audioClipForOnHoverEntered")]
public AudioClip audioClipForOnHoverEnter { get; }
Property Value
Type | Description |
---|---|
AudioClip |
Remarks
audioClipForOnHoverEnter
has been deprecated. Use audioClipForOnHoverEntered instead.
See Also
AudioClipForOnHoverEnter
(Deprecated) The AudioClip Unity plays on Hover Entered.
Declaration
[Obsolete("AudioClipForOnHoverEnter has been deprecated. Use audioClipForOnHoverEntered instead. (UnityUpgradable) -> audioClipForOnHoverEntered")]
public AudioClip AudioClipForOnHoverEnter { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
Remarks
AudioClipForOnHoverEnter
has been deprecated. Use audioClipForOnHoverEntered instead.
See Also
audioClipForOnHoverEntered
The AudioClip Unity plays on Hover Entered.
Declaration
public AudioClip audioClipForOnHoverEntered { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
See Also
audioClipForOnHoverExit
(Deprecated) The AudioClip Unity plays on Hover Exited.
Declaration
[Obsolete("audioClipForOnHoverExit has been deprecated. Use audioClipForOnHoverExited instead. (UnityUpgradable) -> audioClipForOnHoverExited")]
public AudioClip audioClipForOnHoverExit { get; }
Property Value
Type | Description |
---|---|
AudioClip |
Remarks
audioClipForOnHoverExit
has been deprecated. Use audioClipForOnHoverExited instead.
See Also
AudioClipForOnHoverExit
(Deprecated) The AudioClip Unity plays on Hover Exited.
Declaration
[Obsolete("AudioClipForOnHoverExit has been deprecated. Use audioClipForOnHoverExited instead. (UnityUpgradable) -> audioClipForOnHoverExited")]
public AudioClip AudioClipForOnHoverExit { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
Remarks
AudioClipForOnHoverExit
has been deprecated. Use audioClipForOnHoverExited instead.
See Also
audioClipForOnHoverExited
The AudioClip Unity plays on Hover Exited.
Declaration
public AudioClip audioClipForOnHoverExited { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
See Also
audioClipForOnSelectCanceled
The AudioClip Unity plays on Select Canceled.
Declaration
public AudioClip audioClipForOnSelectCanceled { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
See Also
audioClipForOnSelectEnter
(Deprecated) The AudioClip Unity plays on Select Entered.
Declaration
[Obsolete("audioClipForOnSelectEnter has been deprecated. Use audioClipForOnSelectEntered instead. (UnityUpgradable) -> audioClipForOnSelectEntered")]
public AudioClip audioClipForOnSelectEnter { get; }
Property Value
Type | Description |
---|---|
AudioClip |
Remarks
audioClipForOnSelectEnter
has been deprecated. Use audioClipForOnSelectEntered instead.
See Also
AudioClipForOnSelectEnter
(Deprecated) The AudioClip Unity plays on Select Entered.
Declaration
[Obsolete("AudioClipForOnSelectEnter has been deprecated. Use audioClipForOnSelectEntered instead. (UnityUpgradable) -> audioClipForOnSelectEntered")]
public AudioClip AudioClipForOnSelectEnter { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
Remarks
AudioClipForOnSelectEnter
has been deprecated. Use audioClipForOnSelectEntered instead.
See Also
audioClipForOnSelectEntered
The AudioClip Unity plays on Select Entered.
Declaration
public AudioClip audioClipForOnSelectEntered { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
See Also
audioClipForOnSelectExit
(Deprecated) The AudioClip Unity plays on Select Exited.
Declaration
[Obsolete("audioClipForOnSelectExit has been deprecated. Use audioClipForOnSelectExited instead. (UnityUpgradable) -> audioClipForOnSelectExited")]
public AudioClip audioClipForOnSelectExit { get; }
Property Value
Type | Description |
---|---|
AudioClip |
Remarks
audioClipForOnSelectExit
has been deprecated. Use audioClipForOnSelectExited instead.
See Also
AudioClipForOnSelectExit
(Deprecated) The AudioClip Unity plays on Select Exited.
Declaration
[Obsolete("AudioClipForOnSelectExit has been deprecated. Use audioClipForOnSelectExited instead. (UnityUpgradable) -> audioClipForOnSelectExited")]
public AudioClip AudioClipForOnSelectExit { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
Remarks
AudioClipForOnSelectExit
has been deprecated. Use audioClipForOnSelectExited instead.
See Also
audioClipForOnSelectExited
The AudioClip Unity plays on Select Exited.
Declaration
public AudioClip audioClipForOnSelectExited { get; set; }
Property Value
Type | Description |
---|---|
AudioClip |
See Also
hapticHoverCancelDuration
The Haptics duration (in seconds) Unity plays on Hover Canceled.
Declaration
public float hapticHoverCancelDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticHoverCancelIntensity
The Haptics intensity Unity plays on Hover Canceled.
Declaration
public float hapticHoverCancelIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticHoverEnterDuration
The Haptics duration (in seconds) Unity plays on Hover Entered.
Declaration
public float hapticHoverEnterDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticHoverEnterIntensity
The Haptics intensity Unity plays on Hover Entered.
Declaration
public float hapticHoverEnterIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticHoverExitDuration
The Haptics duration (in seconds) Unity plays on Hover Exited.
Declaration
public float hapticHoverExitDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticHoverExitIntensity
The Haptics intensity Unity plays on Hover Exited.
Declaration
public float hapticHoverExitIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticSelectCancelDuration
The Haptics duration (in seconds) Unity plays on Select Canceled.
Declaration
public float hapticSelectCancelDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticSelectCancelIntensity
The Haptics intensity Unity plays on Select Canceled.
Declaration
public float hapticSelectCancelIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticSelectEnterDuration
The Haptics duration (in seconds) Unity plays on Select Entered.
Declaration
public float hapticSelectEnterDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticSelectEnterIntensity
The Haptics intensity Unity plays on Select Entered.
Declaration
public float hapticSelectEnterIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticSelectExitDuration
The Haptics duration (in seconds) Unity plays on Select Exited.
Declaration
public float hapticSelectExitDuration { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hapticSelectExitIntensity
The Haptics intensity Unity plays on Select Exited.
Declaration
public float hapticSelectExitIntensity { get; set; }
Property Value
Type | Description |
---|---|
Single |
See Also
hideControllerOnSelect
Controls whether this Interactor should hide the controller model on selection.
Declaration
public bool hideControllerOnSelect { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
isSelectActive
(Read Only) Indicates whether this Interactor is in a state where it could select.
Declaration
public override bool isSelectActive { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
isUISelectActive
(Read Only) Whether or not Unity considers the UI Press controller input pressed.
Declaration
protected bool isUISelectActive { get; }
Property Value
Type | Description |
---|---|
Boolean |
playAudioClipOnHoverCanceled
Controls whether Unity plays an AudioClip on Hover Canceled.
Declaration
public bool playAudioClipOnHoverCanceled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playAudioClipOnHoverEnter
(Deprecated) Controls whether Unity plays an AudioClip on Hover Entered.
Declaration
[Obsolete("playAudioClipOnHoverEnter has been deprecated. Use playAudioClipOnHoverEntered instead. (UnityUpgradable) -> playAudioClipOnHoverEntered")]
public bool playAudioClipOnHoverEnter { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
playAudioClipOnHoverEnter
has been deprecated. Use playAudioClipOnHoverEntered instead.
See Also
playAudioClipOnHoverEntered
Controls whether Unity plays an AudioClip on Hover Entered.
Declaration
public bool playAudioClipOnHoverEntered { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playAudioClipOnHoverExit
(Deprecated) Controls whether Unity plays an AudioClip on Hover Exited.
Declaration
[Obsolete("playAudioClipOnHoverExit has been deprecated. Use playAudioClipOnHoverExited instead. (UnityUpgradable) -> playAudioClipOnHoverExited")]
public bool playAudioClipOnHoverExit { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
playAudioClipOnHoverExit
has been deprecated. Use playAudioClipOnHoverExited instead.
See Also
playAudioClipOnHoverExited
Controls whether Unity plays an AudioClip on Hover Exited.
Declaration
public bool playAudioClipOnHoverExited { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playAudioClipOnSelectCanceled
Controls whether Unity plays an AudioClip on Select Canceled.
Declaration
public bool playAudioClipOnSelectCanceled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playAudioClipOnSelectEnter
(Deprecated) Controls whether Unity plays an AudioClip on Select Entered.
Declaration
[Obsolete("playAudioClipOnSelectEnter has been deprecated. Use playAudioClipOnSelectEntered instead. (UnityUpgradable) -> playAudioClipOnSelectEntered")]
public bool playAudioClipOnSelectEnter { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
playAudioClipOnSelectEnter
has been deprecated. Use playAudioClipOnSelectEntered instead.
See Also
playAudioClipOnSelectEntered
Controls whether Unity plays an AudioClip on Select Entered.
Declaration
public bool playAudioClipOnSelectEntered { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playAudioClipOnSelectExit
(Deprecated) Controls whether Unity plays an AudioClip on Select Exited.
Declaration
[Obsolete("playAudioClipOnSelectExit has been deprecated. Use playAudioClipOnSelectExited instead. (UnityUpgradable) -> playAudioClipOnSelectExited")]
public bool playAudioClipOnSelectExit { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
playAudioClipOnSelectExit
has been deprecated. Use playAudioClipOnSelectExited instead.
See Also
playAudioClipOnSelectExited
Controls whether Unity plays an AudioClip on Select Exited.
Declaration
public bool playAudioClipOnSelectExited { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playHapticsOnHoverCanceled
Controls whether Unity plays haptics on Hover Canceled.
Declaration
public bool playHapticsOnHoverCanceled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playHapticsOnHoverEnter
(Deprecated) Controls whether Unity plays haptics on Hover Entered.
Declaration
[Obsolete("playHapticsOnHoverEnter has been deprecated. Use playHapticsOnHoverEntered instead. (UnityUpgradable) -> playHapticsOnHoverEntered")]
public bool playHapticsOnHoverEnter { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
playHapticsOnHoverEnter
has been deprecated. Use playHapticsOnHoverEntered instead.
See Also
playHapticsOnHoverEntered
Controls whether Unity plays haptics on Hover Entered.
Declaration
public bool playHapticsOnHoverEntered { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playHapticsOnHoverExited
Controls whether Unity plays haptics on Hover Exited.
Declaration
public bool playHapticsOnHoverExited { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playHapticsOnSelectCanceled
Controls whether Unity plays haptics on Select Canceled.
Declaration
public bool playHapticsOnSelectCanceled { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playHapticsOnSelectEnter
(Deprecated) Controls whether Unity plays haptics on Select Entered.
Declaration
[Obsolete("playHapticsOnSelectEnter has been deprecated. Use playHapticsOnSelectEntered instead. (UnityUpgradable) -> playHapticsOnSelectEntered")]
public bool playHapticsOnSelectEnter { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
playHapticsOnSelectEnter
has been deprecated. Use playHapticsOnSelectEntered instead.
See Also
playHapticsOnSelectEntered
Controls whether Unity plays haptics on Select Entered.
Declaration
public bool playHapticsOnSelectEntered { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
playHapticsOnSelectExit
(Deprecated) Controls whether Unity plays haptics on Select Exited.
Declaration
[Obsolete("playHapticsOnSelectExit has been deprecated. Use playHapticsOnSelectExited instead. (UnityUpgradable) -> playHapticsOnSelectExited")]
public bool playHapticsOnSelectExit { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
playHapticsOnSelectExit
has been deprecated. Use playHapticsOnSelectExited instead.
See Also
playHapticsOnSelectExited
Controls whether Unity plays haptics on Select Exited.
Declaration
public bool playHapticsOnSelectExited { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
selectActionTrigger
Choose how Unity interprets the select input action from the controller. Controls between different input styles for determining if this Interactor can select, such as whether the button is currently pressed or just toggles the active state.
Declaration
public XRBaseControllerInteractor.InputTriggerType selectActionTrigger { get; set; }
Property Value
Type | Description |
---|---|
XRBaseControllerInteractor.InputTriggerType |
See Also
shouldActivate
(Read Only) Indicates whether this interactor is in a state where it should send the activate event this frame.
Declaration
public virtual bool shouldActivate { get; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
shouldDeactivate
(Read Only) Indicates whether this interactor is in a state where it should send the deactivate event this frame.
Declaration
public virtual bool shouldDeactivate { get; }
Property Value
Type | Description |
---|---|
Boolean |
Implements
validTargets
(Deprecated) (Read Only) A list of Interactables that this Interactor could possibly interact with this frame.
Declaration
[Obsolete("validTargets has been deprecated. Use a property of type List<IXRInteractable> instead.")]
protected virtual List<XRBaseInteractable> validTargets { get; }
Property Value
Type | Description |
---|---|
List<XRBaseInteractable> |
xrController
The controller instance that is queried for input.
Declaration
public XRBaseController xrController { get; set; }
Property Value
Type | Description |
---|---|
XRBaseController |
Methods
Awake()
See MonoBehaviour.
Declaration
protected override void Awake()
Overrides
GetActivateTargets(List<IXRActivateInteractable>)
Retrieve the list of Interactables that this Interactor could possibly activate or deactivate this frame.
Declaration
public virtual void GetActivateTargets(List<IXRActivateInteractable> targets)
Parameters
Type | Name | Description |
---|---|---|
List<IXRActivateInteractable> | targets | The results list to populate with Interactables that are valid for activate or deactivate. |
Implements
Remarks
When implementing this method, Unity expects you to clear targets
before adding to it.
OnHoverEntering(HoverEnterEventArgs)
The XRInteractionManager calls this method right before the Interactor first initiates hovering over an Interactable in a first pass.
Declaration
protected override void OnHoverEntering(HoverEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverEnterEventArgs | args | Event data containing the Interactable that is being hovered over. |
Overrides
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 override void OnHoverExiting(HoverExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
HoverExitEventArgs | args | Event data containing the Interactable that is no longer hovered over. |
Overrides
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 override void OnSelectEntering(SelectEnterEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectEnterEventArgs | args | Event data containing the Interactable that is being selected. |
Overrides
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 override void OnSelectExiting(SelectExitEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
SelectExitEventArgs | args | Event data containing the Interactable that is no longer selected. |
Overrides
Remarks
args
is only valid during this method call, do not hold a reference to it.
See Also
PlayAudio(AudioClip)
Play an AudioClip.
Declaration
protected virtual void PlayAudio(AudioClip audioClip)
Parameters
Type | Name | Description |
---|---|---|
AudioClip | audioClip | The clip to play. |
PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase)
The XRInteractionManager calls this method to update the Interactor before interaction events occur. Interactors should use this method to do tasks like determine their valid targets.
Declaration
public override void PreprocessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Overrides
Implements
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase)
The XRInteractionManager calls this method to update the Interactor after interaction events occur.
Declaration
public override void ProcessInteractor(XRInteractionUpdateOrder.UpdatePhase updatePhase)
Parameters
Type | Name | Description |
---|---|---|
XRInteractionUpdateOrder.UpdatePhase | updatePhase | The update phase this is called during. |
Overrides
Implements
Remarks
Please see the XRInteractionManager and XRInteractionUpdateOrder.UpdatePhase documentation for more details on update order.
See Also
SendHapticImpulse(Single, Single)
Play a haptic impulse on the controller if one is available.
Declaration
public bool SendHapticImpulse(float amplitude, float duration)
Parameters
Type | Name | Description |
---|---|---|
Single | amplitude | Amplitude (from 0.0 to 1.0) to play impulse at. |
Single | duration | Duration (in seconds) to play haptic impulse. |
Returns
Type | Description |
---|---|
Boolean |