API reference
API reference
Select your platform
No SDKs available
No versions available

Interactor Class

Extends MonoBehaviour
Base class for most concrete interactor types.
New interactors can be created by inheriting from this class directly; however, it is also common for new interactors to inherit from PointerInteractor<TInteractor, TInteractable>, a descendent type which adds features for characterizing interactions as PointerEvents.
Interactions can be wholly defined by three things: the concrete Interactor, the concrete Interactable, and the logic governing their coordination. Subclasses are responsible for implementing that coordination logic via template methods that operate on the concrete interactor and interactable classes.
This type has a curiously recurring generic argument TInteractor , which should be the concrete interactor type which derives from this type and is uniquely associated with TInteractable .

Protected Fields

_candidate : TInteractable
Signature
TInteractable Oculus.Interaction.Interactor< TInteractor, TInteractable >._candidate
_interactable : TInteractable
Signature
TInteractable Oculus.Interaction.Interactor< TInteractor, TInteractable >._interactable
_nativeId : ulong
Signature
ulong Oculus.Interaction.Interactor< TInteractor, TInteractable >._nativeId
_selectedInteractable : TInteractable
Signature
TInteractable Oculus.Interaction.Interactor< TInteractor, TInteractable >._selectedInteractable
_started : bool
Signature
bool Oculus.Interaction.Interactor< TInteractor, TInteractable >._started

Fields

Candidate : TInteractable
The current interaction candidate.
This is the TInteractable with which this interactor can, but may not yet have begun to, interact.
The candidate is primarily used by the interactor itself (as the thing it knows it can interact with next) and by containing interactor groups, which frequently use the availability or unavailability of a candidate in a given frame to assess which interactors should perform the interactions of which they're capable.
Signature
TInteractable Oculus.Interaction.Interactor< TInteractor, TInteractable >.Candidate
HasCandidate : bool
Implementation of IInteractorView.HasCandidate; for details, please refer to the related documentation provided for that interface.
Signature
bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.HasCandidate
HasInteractable : bool
Implementation of IInteractorView.HasInteractable; for details, please refer to the related documentation provided for that interface.
Signature
bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.HasInteractable
HasSelectedInteractable : bool
Implementation of IInteractorView.HasSelectedInteractable; for details, please refer to the related documentation provided for that interface.
Signature
bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.HasSelectedInteractable
Identifier : int
Implementation of IInteractorView.Identifier; for details, please refer to the related documentation provided for that interface.
Signature
int Oculus.Interaction.Interactor< TInteractor, TInteractable >.Identifier
Interactable : TInteractable
The TInteractable with which this interactor is currently interacting.
This may or may not be the same as the Candidate
Signature
TInteractable Oculus.Interaction.Interactor< TInteractor, TInteractable >.Interactable
SelectedInteractable : TInteractable
The TInteractable which this interactor is currently selecting.
This must be the same as Interactable, and neither SelectedInteractable nor Interactable will change value until this interactor unselects.
Signature
TInteractable Oculus.Interaction.Interactor< TInteractor, TInteractable >.SelectedInteractable
WhenInteractableSelected : MAction< TInteractable >
An event indicating that a new value is available via SelectedInteractable.
In terms of InteractorState, this occurs when the interactor begins selecting a new interactable.
Signature
MAction<TInteractable> Oculus.Interaction.Interactor< TInteractor, TInteractable >.WhenInteractableSelected
WhenInteractableSet : MAction< TInteractable >
An event indicating that a new value is available via Interactable.
In terms of InteractorState, this occurs when the interactor begins hovering a new interactable.
Signature
MAction<TInteractable> Oculus.Interaction.Interactor< TInteractor, TInteractable >.WhenInteractableSet
WhenInteractableUnselected : MAction< TInteractable >
An event indicating that SelectedInteractable will now return null.
In terms of InteractorState, this occurs when the interactor ceases selecting an interactable.
Signature
MAction<TInteractable> Oculus.Interaction.Interactor< TInteractor, TInteractable >.WhenInteractableUnselected
WhenInteractableUnset : MAction< TInteractable >
An event indicating that Interactable will now return null.
In terms of InteractorState, this occurs when the interactor ceases hovering an interactable.
Signature
MAction<TInteractable> Oculus.Interaction.Interactor< TInteractor, TInteractable >.WhenInteractableUnset

Protected Properties

Selector : ISelector
[Get][Set]
Signature
ISelector Oculus.Interaction.Interactor< TInteractor, TInteractable >.Selector

Properties

CandidateProperties : object
[Get]
Implementation of IInteractorView.CandidateProperties; for details, please refer to the related documentation provided for that interface.
Signature
virtual object Oculus.Interaction.Interactor< TInteractor, TInteractable >.CandidateProperties
Data : object
[Get]
Implementation of IInteractorView.Data; for details, please refer to the related documentation provided for that interface.
Signature
object Oculus.Interaction.Interactor< TInteractor, TInteractable >.Data
IsRootDriver : bool
[Get][Set]
Implementation of IUpdateDriver.IsRootDriver; for details, please refer to the related documentation provided for that interface.
Signature
bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.IsRootDriver
MaxIterationsPerFrame : int
[Get][Set]
This is an internal API which sets or retrieves the maximum number of times the interactor group will execute its processing loop (assessing and enacting changes in the groups InteractorState, among other effects) within a single frame.
The implications of this are complex, and depending on or modifying this value is not recommended.
Signature
int Oculus.Interaction.Interactor< TInteractor, TInteractable >.MaxIterationsPerFrame
ShouldHover : bool
[Get]
Implementation of IInteractor.ShouldHover; for details, please refer to the related documentation provided for that interface.
Signature
virtual bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.ShouldHover
ShouldSelect : bool
[Get]
Implementation of IInteractor.ShouldSelect; for details, please refer to the related documentation provided for that interface.
Signature
bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.ShouldSelect
ShouldUnhover : bool
[Get]
Implementation of IInteractor.ShouldUnhover; for details, please refer to the related documentation provided for that interface.
Signature
virtual bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.ShouldUnhover
ShouldUnselect : bool
[Get]
Implementation of IInteractor.ShouldUnselect; for details, please refer to the related documentation provided for that interface.
Signature
bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.ShouldUnselect
State : InteractorState
[Get]
Implementation of IInteractorView.State; for details, please refer to the related documentation provided for that interface.
Signature
InteractorState Oculus.Interaction.Interactor< TInteractor, TInteractable >.State

Events

WhenPostprocessed : Action
Implementation of IInteractorView.WhenPostprocessed; for details, please refer to the related documentation provided for that interface.
Signature
Action Oculus.Interaction.Interactor< TInteractor, TInteractable >.WhenPostprocessed
WhenPreprocessed : Action
Implementation of IInteractorView.WhenPreprocessed; for details, please refer to the related documentation provided for that interface.
Signature
Action Oculus.Interaction.Interactor< TInteractor, TInteractable >.WhenPreprocessed
WhenProcessed : Action
Implementation of IInteractorView.WhenProcessed; for details, please refer to the related documentation provided for that interface.
Signature
Action Oculus.Interaction.Interactor< TInteractor, TInteractable >.WhenProcessed
WhenStateChanged : Action< InteractorStateChangeArgs >
Implementation of IInteractorView.WhenStateChanged; for details, please refer to the related documentation provided for that interface.
Signature
Action<InteractorStateChangeArgs> Oculus.Interaction.Interactor< TInteractor, TInteractable >.WhenStateChanged

Protected Methods

Awake ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Awake()
Returns
void
ComputeCandidate ()
Signature
abstract TInteractable Oculus.Interaction.Interactor< TInteractor, TInteractable >.ComputeCandidate()
Returns
abstract TInteractable
ComputeCandidateTiebreaker ( a , b )
Signature
virtual int Oculus.Interaction.Interactor< TInteractor, TInteractable >.ComputeCandidateTiebreaker(TInteractable a, TInteractable b)
Parameters
a: TInteractable
b: TInteractable
Returns
int
ComputeShouldSelect ()
Signature
virtual bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.ComputeShouldSelect()
Returns
bool
ComputeShouldUnselect ()
Signature
virtual bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.ComputeShouldUnselect()
Returns
bool
DoHoverUpdate ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.DoHoverUpdate()
Returns
void
DoNormalUpdate ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.DoNormalUpdate()
Returns
void
DoPostprocess ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.DoPostprocess()
Returns
void
DoPreprocess ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.DoPreprocess()
Returns
void
DoSelectUpdate ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.DoSelectUpdate()
Returns
void
HandleDisabled ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.HandleDisabled()
Returns
void
HandleEnabled ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.HandleEnabled()
Returns
void
HandleSelected ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.HandleSelected()
Returns
void
HandleUnselected ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.HandleUnselected()
Returns
void
InteractableSelected ( interactable )
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.InteractableSelected(TInteractable interactable)
Parameters
interactable: TInteractable
Returns
void
InteractableSet ( interactable )
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.InteractableSet(TInteractable interactable)
Parameters
interactable: TInteractable
Returns
void
InteractableUnselected ( interactable )
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.InteractableUnselected(TInteractable interactable)
Parameters
interactable: TInteractable
Returns
void
InteractableUnset ( interactable )
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.InteractableUnset(TInteractable interactable)
Parameters
interactable: TInteractable
Returns
void
OnDestroy ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.OnDestroy()
Returns
void
OnDisable ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.OnDisable()
Returns
void
OnEnable ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.OnEnable()
Returns
void
Start ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Start()
Returns
void
Update ()
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Update()
Returns
void

Methods

CanSelect ( interactable )
Determines if this interactor can interact with an interactable.
Despite its name, this method is not a part of the interactor processing flow alongside ShouldSelect and Select; both of those refer to things that respectively should and do happen now, as part of processing. CanSelect does not specifically test whether or not an interactable can be selected right now; for example, a grab interactor can only select interactables that are spatially nearby, but proximity is not taken into account at all by CanSelect. Rather, CanSelect assesses whether an interactable can be selected more generally, such as whether there are any special rules which should prevent the selection even if every other condition were satisfied. InteractableFilters are the primary form such selection-blocking rules take, but descendent classes can introduce any other type of selection blocker they wish by overriding CanSelect.
Signature
virtual bool Oculus.Interaction.Interactor< TInteractor, TInteractable >.CanSelect(TInteractable interactable)
Parameters
interactable: TInteractable  The interactable to check against.
Returns
bool  True if the interactor can interact with the given interactable.
ClearComputeCandidateOverride ()
Clears the function provided in SetComputeCandidateOverride.
This is called when the interactor force releases an interactable.
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.ClearComputeCandidateOverride()
Returns
void
ClearComputeShouldSelectOverride ()
Clears the function provided in SetComputeShouldSelectOverride.
This is called when the interactor force releases an interactable.
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.ClearComputeShouldSelectOverride()
Returns
void
ClearComputeShouldUnselectOverride ()
Clears the function provided in SetComputeShouldUnselectOverride.
This is called when the interactor unselects an interactable.
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.ClearComputeShouldUnselectOverride()
Returns
void
Disable ()
Implementation of IInteractor.Disable; for details, please refer to the related documentation provided for that interface.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Disable()
Returns
void
Drive ()
Implementation of IUpdateDriver.Drive.
This method should never be invoked directly by anything other than this instance (when IsRootDriver is true) or the IUpdateDriver serving the role of root driver.
This method encapsulates the entire processing flow of the interactor, invoking many of the core methods from IInteractor (Enable, Process, etc.) in the correct order and with the appropriate state management. Modification to or deviation from this flow very fundamentally changes how interactors work and is likely to result in undefined behavior. Consequently, neither directly invoking nor overriding this method is recommended.
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Drive()
Returns
void
Enable ()
Implementation of IInteractor.Enable; for details, please refer to the related documentation provided for that interface.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Enable()
Returns
void
Hover ()
Implementation of IInteractor.Hover; for details, please refer to the related documentation provided for that interface.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Hover()
Returns
void
InjectOptionalActiveState ( activeState )
Adds an IActiveStates to a dynamically instantiated Interactor.
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.InjectOptionalActiveState(IActiveState activeState)
Parameters
activeState: IActiveState
Returns
void
InjectOptionalCandidateTiebreaker ( candidateTiebreaker )
Adds an ICandidateComparers to a dynamically instantiated Interactor.
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.InjectOptionalCandidateTiebreaker(IComparer< TInteractable > candidateTiebreaker)
Parameters
candidateTiebreaker: IComparer< TInteractable >
Returns
void
InjectOptionalData ( data )
Sets Data property on a dynamically instantiated Interactor.
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.InjectOptionalData(object data)
Parameters
data: object
Returns
void
InjectOptionalInteractableFilters ( interactableFilters )
Adds a set of IGameObjectFilters to a dynamically instantiated Interactor.
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.InjectOptionalInteractableFilters(List< IGameObjectFilter > interactableFilters)
Parameters
interactableFilters: List< IGameObjectFilter >
Returns
void
InteractableChangesUpdate ()
Causes the interactor to unselect or unhover an interactable.
Called when an interactable is currently selected or hovered but a PointerEvent of type PointerEventType.Cancel occurs.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.InteractableChangesUpdate()
Returns
void
Postprocess ()
Implementation of IInteractor.Process; executes any logic that should run after the interactor-specific logic.
Runs after both Preprocess and Process. This method should never be invoked directly except by either this interactor instance itself or the InteractorGroup to which it belongs.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Postprocess()
Returns
void
Preprocess ()
Implementation of IInteractor.Preprocess; executes any logic that should run before the interactor-specific logic.
Runs before Process and Postprocess. This method should never be invoked directly except by either this interactor instance itself or the InteractorGroup to which it belongs.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Preprocess()
Returns
void
Process ()
Implementation of IInteractor.Process; runs interactor-specific logic based on the interactor's current state.
Runs after Preprocess but before Postprocess. Can be called multiple times per interaction frame, with the number capped by the value of MaxIterationsPerFrame. This method should never be invoked directly except by either this interactor instance itself or the InteractorGroup to which it belongs.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Process()
Returns
void
ProcessCandidate ()
Implementation of IInteractor.ProcessCandidate; for details, please refer to the related documentation provided for that interface.
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.ProcessCandidate()
Returns
void
Select ()
Implementation of IInteractor.Select; for details, please refer to the related documentation provided for that interface.
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Select()
Returns
void
SetComputeCandidateOverride ( computeCandidate , shouldClearOverrideOnSelect )
Overrides the interactor's ComputeCandidate method with a new method.
ComputeCandidate is part of the core processing flow of IInteractors and is the primary way that individual interactors decide what they want to interact with. Computing a new candidate does not actually do the interaction because not all interaction candidates will result in interactions: an InteractorGroup might decide that one interactor's candidate cannot be acted upon because another interactor in the group is already interacting, for example. Managing this nuance, and the state associated with it, is why direct calls to methods like IInteractor.Hover cannot safely be used to force an interactor into a desired state, as attempting to do so violates the interactor's processing flow and may cause it to have invalid internal state. SetComputeCandidateOverride, however, can serve a similar function by arbitrarily controlling candidate discovery in the interactor. In this way, while an interactor still cannot be generally forced to interact with a specific candidate, it can be forced to consider a specific candidate within its proper processing flow, which unless prevented (by an intervening InteractorGroup, for example) can be made to result in the desired interaction.
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.SetComputeCandidateOverride(Func< TInteractable > computeCandidate, bool shouldClearOverrideOnSelect=true)
Parameters
computeCandidate: Func< TInteractable >  The method used instead of the interactable's existing ComputeCandidate() method.
shouldClearOverrideOnSelect: bool  If true, clear the computeCandidate function once you select an interactable.
Returns
void
SetComputeShouldSelectOverride ( computeShouldSelect , clearOverrideOnSelect )
Overrides the interactor's ComputeShouldSelect() method with a new method.
For similar reasons to those discussed in the documentation for SetComputeCandidateOverride(Func<TInteractable>, bool), an interactor cannot be directly forced to select an interactable (except in special, bespoke methods such as HandGrab.HandGrabInteractor.ForceSelect(HandGrab.HandGrabInteractable, bool)), but the logic it uses to decide whether or not to select can be overriden so that its normal processing is guaranteed to result in selection (again, absent intervening forces such as an InteractorGroup).
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.SetComputeShouldSelectOverride(Func< bool > computeShouldSelect, bool clearOverrideOnSelect=true)
Parameters
computeShouldSelect: Func< bool >  The method used instead of the interactor's existing ComputeShouldSelect() method.
clearOverrideOnSelect: bool  If true, clear the computeShouldSelect function once you select an interactable.
Returns
void
SetComputeShouldUnselectOverride ( computeShouldUnselect , clearOverrideOnUnselect )
Overrides the interactor's ComputeShouldUnselect method with a new method.
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.SetComputeShouldUnselectOverride(Func< bool > computeShouldUnselect, bool clearOverrideOnUnselect=true)
Parameters
computeShouldUnselect: Func< bool >  The method used instead of the interactor's existing ComputeShouldUnselect() method.
clearOverrideOnUnselect: bool  If true, clear the computeShouldUnselect function once you unselect an interactable.
Returns
void
Unhover ()
Implementation of IInteractor.Unhover; for details, please refer to the related documentation provided for that interface.
Signature
void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Unhover()
Returns
void
Unselect ()
Implementation of IInteractor.Unselect; for details, please refer to the related documentation provided for that interface.
Signature
virtual void Oculus.Interaction.Interactor< TInteractor, TInteractable >.Unselect()
Returns
void