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

Interactable Class

Extends MonoBehaviour, IInteractable
Base class for most concrete interactable types.
New interactables can be created by inheriting from this class directly; however, it is also common for new interactables to inherit from PointerInteractable<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 TInteractable , which should be the concrete interactable type which derives from this type and is uniquely associated with TInteractor .

Properties

Implementation of IInteractableView.Data; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractableView.MaxInteractors; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractableView.MaxSelectingInteractors; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractableView.State; for details, please refer to the related documentation provided for that interface.

Protected Fields

bool _started[Get]

Fields

Implementation of IInteractableView.InteractorViews; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractableView.SelectingInteractorViews; for details, please refer to the related documentation provided for that interface.
An event indicating that a new interactor has been added to InteractorViews.
In terms of InteractableState, this occurs when this interactable is hovered by a new interactor.
An event indicating that an interactor has been removed from InteractorViews.
In terms of InteractableState, this occurs when this interactable ceases to be hovered by an interactor.
An event indicating that a new interactor has been added to SelectingInteractorViews.
In terms of InteractableState, this occurs when this interactable is selected by a new interactor.
An event indicating that an interactor has been removed from SelectingInteractorViews.
In terms of InteractableState, this occurs when this interactable ceases to be selected by an interactor.
Enumerates all the TInteractor s currently associated with this instance.
This list is identical to that returned by InteractorViews, but the returned elements are of type TInteractor instead of IInteractorView.
Enumerates all the TInteractor s currently selecting this instance.
This list is identical to that returned by SelectingInteractorViews, but the returned elements are of type TInteractor instead of IInteractorView.

Events

Implementation of IInteractableView.WhenStateChanged; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractableView.WhenInteractorViewAdded; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractableView.WhenInteractorViewRemoved; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractableView.WhenSelectingInteractorViewAdded; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractableView.WhenSelectingInteractorViewRemoved; for details, please refer to the related documentation provided for that interface.

Public Statics

Retrieves the InteractableRegistry<TInteractor, TInteractable> for the concrete interactable type TInteractable .
The interactable registry is a static global container which, at any given moment, contains all the TInteractable s extant and enabled at that moment.

Protected Functions

virtual void InteractorAdded
( TInteractor interactor )
virtual void InteractorRemoved
( TInteractor interactor )
virtual void SelectingInteractorAdded
( TInteractor interactor )
virtual void SelectingInteractorRemoved
( TInteractor interactor )
virtual void Awake ( )
virtual void Start ( )
virtual void OnEnable ( )
virtual void OnDisable ( )
virtual void SetRegistry
( InteractableRegistry< TInteractor, TInteractable > registry )

Member Functions

Adds a TInteractor to this interactable instance.
This is an internal API and should only be invoked by the interactor being added; directly invoking this from outside the normal interactor processing flow risks creating an asymmetric interactor-interactable relationship (i.e., a situation where an interactor believes it is associated with an interactable in a certain way, but the interactable believes something else), which can result in undefined behavior.
Removes a TInteractor from this interactable instance.
This is an internal API and should only be invoked by the interactor being removed; directly invoking this from outside the normal interactor processing flow risks creating an asymmetric interactor-interactable relationship (i.e., a situation where an interactor believes it is associated with an interactable in a certain way, but the interactable believes something else), which can result in undefined behavior.
Adds a TInteractor to the list of interactors selecting this interactable instance.
This is an internal API and should only be invoked by the interactor being added; directly invoking this from outside the normal interactor processing flow risks creating an asymmetric interactor-interactable relationship (i.e., a situation where an interactor believes it is associated with an interactable in a certain way, but the interactable believes something else), which can result in undefined behavior.
Removes a TInteractor from the list of interactors selecting this interactable instance.
This is an internal API and should only be invoked by the interactor being removed; directly invoking this from outside the normal interactor processing flow risks creating an asymmetric interactor-interactable relationship (i.e., a situation where an interactor believes it is associated with an interactable in a certain way, but the interactable believes something else), which can result in undefined behavior.
Determines if the interactable can be interacted on by the given interactor.
Similar to Interactor<TInteractor, TInteractable>.CanSelect(TInteractable), the specific question answered by this method is not about interaction candidacy but more about interaction possibility: it does not test whether the interactor might select this interactable, but only whether the interactor would be able to if it tried. This is a more ephemeral answer for TInteractable than for TInteractor ; enablement and number of currently active interactions (both highly variable considerations over time) factor into this test for the interactable. To emphasize this point Interactor<TInteractor, TInteractable>.CanSelect(TInteractable) and Interactable<TInteractor, TInteractable>.CanBeSelectedBy(TInteractor) are asymmetric: the fact that an interactor is capable of selecting an interactable does not imply that the interactable is capable of being selected by that interactor, nor vice versa, and both must be true in order for a valid interaction to be possible.
Parameters
interactor
The interactor that intends to interact with the interactable.
Returns
True if the interactor can interact with the interactable, false otherwise.
Determines if the interactable is being hovered by the given interactor.
This is a convenience method identical to calling the Contains() method on Interactors.
Parameters
interactor
The interactor to check for hovering.
Returns
True if the interactor is hovering the interactable, false otherwise.
Determines if the interactable is being selected by the given interactor.
This is a convenience method identical to calling the Contains() method on SelectingInteractors.
Parameters
interactor
The interactor to check for selecting.
Returns
True if the interactor is selecting the interactable, false otherwise.
Implementation of IInteractable.Enable; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractable.Disable; for details, please refer to the related documentation provided for that interface.
Implementation of IInteractable.RemoveInteractorByIdentifier(int); for details, please refer to the related documentation provided for that interface.
Sets the interactor filters for this interactable on a dynamically instantiated GameObject.
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Sets the Data for this interactable on a dynamically instantiated GameObject.
This method exists to support Interaction SDK's dependency injection pattern and is not needed for typical Unity Editor-based usage.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon