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

Interactor Class

Extends MonoBehaviour, IInteractor
Interactor provides a base template for any kind of interaction.
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.

Protected Fields

ulong _nativeId[Get]
TInteractable _candidate[Get]
TInteractable _interactable[Get]
TInteractable _selectedInteractable[Get]
bool _started[Get]

Properties

bool ShouldHover[Get]
bool ShouldUnhover[Get]
bool ShouldSelect[Get]
bool ShouldUnselect[Get]
int MaxIterationsPerFrame[Get]
ISelector Selector[Get]
bool QueuedSelect[Get]
bool QueuedUnselect[Get]
InteractorState State[Get]
object CandidateProperties[Get]
TInteractable Candidate[Get]
TInteractable Interactable[Get]
TInteractable SelectedInteractable[Get]
bool HasCandidate[Get]
bool HasInteractable[Get]
bool HasSelectedInteractable[Get]
MAction< TInteractable > WhenInteractableSet[Get]
MAction< TInteractable > WhenInteractableUnset[Get]
MAction< TInteractable > WhenInteractableSelected[Get]
MAction< TInteractable > WhenInteractableUnselected[Get]
int Identifier[Get]
object Data[Get]
bool IsRootDriver[Get]

Events

Action< InteractorStateChangeArgs > WhenStateChanged
Action WhenPreprocessed
Action WhenProcessed
Action WhenPostprocessed

Protected Functions

virtual void DoPreprocess ( )
virtual void DoNormalUpdate ( )
virtual void DoHoverUpdate ( )
virtual void DoSelectUpdate ( )
virtual void DoPostprocess ( )
virtual bool ComputeShouldSelect ( )
virtual bool ComputeShouldUnselect ( )
virtual void InteractableSet
( TInteractable interactable )
virtual void InteractableUnset
( TInteractable interactable )
virtual void InteractableSelected
( TInteractable interactable )
virtual void InteractableUnselected
( TInteractable interactable )
virtual void Awake ( )
virtual void Start ( )
virtual void OnEnable ( )
virtual void OnDisable ( )
virtual void OnDestroy ( )
abstract TInteractable ComputeCandidate ( )
virtual int ComputeCandidateTiebreaker
( TInteractable a,
TInteractable b )
virtual void HandleEnabled ( )
virtual void HandleDisabled ( )
virtual void HandleSelected ( )
virtual void HandleUnselected ( )
virtual void Update ( )

Member Functions

Overrides the interactor's ComputeCandidate() method with a new method.
Parameters
computeCandidate
The method used instead of the interactable's existing ComputeCandidate() method.
shouldClearOverrideOnSelect
If true, clear the computeCandidate function once you select an interactable.
Clears the function provided in SetComputeCandidateOverride().
This is called when the interactor force releases an interactable.
Overrides the interactor's ComputeShouldSelect() method with a new method.
Parameters
computeShouldSelect
The method used instead of the interactor's existing ComputeShouldSelect() method.
clearOverrideOnSelect
If true, clear the computeShouldSelect function once you select an interactable.
Clears the function provided in SetComputeShouldSelectOverride().
This is called when the interactor force releases an interactable.
Overrides the interactor's ComputeShouldUnselect() method with a new method.
Parameters
computeShouldUnselect
The method used instead of the interactor's existing ComputeShouldUnselect() method.
clearOverrideOnUnselect
If true, clear the computeShouldUnselect function once you unselect an interactable.
Clears the function provided in SetComputeShouldUnselectOverride().
This is called when the interactor unselects an interactable.
Executes any logic that should run before the interactor-specific logic.
Runs before Process() and Postprocess().
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.
Executes any logic that should run after the interactor-specific logic.
Runs after both Process() and Preprocess().
Determines what the interactable candidate should be.
Causes the interactor to unselect or unhover an interactable.
Called when an interactable is currently selected or hovered but a cancel <cref="IPointerEvent" /> occurs.
Hovers the current candidate.
Unhovers the current candidate.
Selects the target interactable and sets the interactor's state to select.
Unselects the currently selected interactable and sets the interactor's state to hover.
Determines if an interactor can interact with an interactable.
Parameters
interactable
The interactable to check against.
Returns
True if the interactor can interact with the given interactable.
Enables a disabled interactor.
Disables an interactor.
Coordinates all of the interactor's interaction logic.
Sets an IActiveState for the interactor on a dynamically instantiated GameObject.
Sets an set of interactable filters for the interactor on a dynamically instantiated GameObject.
Sets a candidate tiebreaker for the interactor on a dynamically instantiated GameObject.
Sets data for the interactor on a dynamically instantiated GameObject.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon