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

Interactable Class

Extends MonoBehaviour, IInteractable
Interactable provides a base template for any kind of interactable object.
An Interactable can have Hover and HandleSelected Interactor(s) acting on it. Concrete Interactables can define whether they have a One-to-One or One-to-Many relationship with their associated concrete Interactors.

Properties

object Data[Get]
int MaxInteractors[Get]
int MaxSelectingInteractors[Get]
IEnumerable< IInteractorView > InteractorViews[Get]
IEnumerable< IInteractorView > SelectingInteractorViews[Get]
MAction< TInteractor > WhenInteractorAdded[Get]
MAction< TInteractor > WhenInteractorRemoved[Get]
MAction< TInteractor > WhenSelectingInteractorAdded[Get]
MAction< TInteractor > WhenSelectingInteractorRemoved[Get]
InteractableState State[Get]
static InteractableRegistry< TInteractor, TInteractable > Registry[Get]
IEnumerableHashSet< TInteractor > Interactors[Get]
IEnumerableHashSet< TInteractor > SelectingInteractors[Get]

Protected Fields

bool _started[Get]

Events

Action< InteractableStateChangeArgs > WhenStateChanged
Action< IInteractorView > WhenInteractorViewAdded
Action< IInteractorView > WhenInteractorViewRemoved
Action< IInteractorView > WhenSelectingInteractorViewAdded
Action< IInteractorView > WhenSelectingInteractorViewRemoved

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 an interactor to the interactable.
Removes an interactor from the interactable.
Adds a selecting interactor to the interactable.
Removes a selecting interactor from the interactable.
Determines if the interactable can be interacted on by the given interactor.
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.
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.
Parameters
interactor
The interactor to check for selecting.
Returns
True if the interactor is selecting the interactable, false otherwise.
void Enable ( )
void Disable ( )
Uses an interactor's unique ID to remove it from this interactable.
Parameters
id
The ID of the interactor to remove.
Sets interactor filters for this interactable on a dynamically instantiated GameObject.
Sets data for this interactable on a dynamically instantiated GameObject.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon