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

Interactable Class

Extends MonoBehaviour
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 .

Protected Fields

_started : bool
Signature
bool Oculus.Interaction.Interactable< TInteractor, TInteractable >._started

Fields

Identifier : int
An identifier uniquely associated with the conceptual Interactable instance.
Identifiers are associated with individual instances of concrete Interactable types, with each instance assigned a unique identifier.
Signature
int Oculus.Interaction.Interactable< TInteractor, TInteractable >.Identifier
Interactors : IEnumerableHashSet< TInteractor >
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.
Signature
IEnumerableHashSet<TInteractor> Oculus.Interaction.Interactable< TInteractor, TInteractable >.Interactors
InteractorViews : IEnumerable< IInteractorView >
Implementation of IInteractableView.InteractorViews; for details, please refer to the related documentation provided for that interface.
Signature
IEnumerable<IInteractorView> Oculus.Interaction.Interactable< TInteractor, TInteractable >.InteractorViews
SelectingInteractors : IEnumerableHashSet< TInteractor >
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.
Signature
IEnumerableHashSet<TInteractor> Oculus.Interaction.Interactable< TInteractor, TInteractable >.SelectingInteractors
SelectingInteractorViews : IEnumerable< IInteractorView >
Implementation of IInteractableView.SelectingInteractorViews; for details, please refer to the related documentation provided for that interface.
Signature
IEnumerable<IInteractorView> Oculus.Interaction.Interactable< TInteractor, TInteractable >.SelectingInteractorViews
WhenInteractorAdded : MAction< TInteractor >
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.
Signature
MAction<TInteractor> Oculus.Interaction.Interactable< TInteractor, TInteractable >.WhenInteractorAdded
WhenInteractorRemoved : MAction< TInteractor >
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.
Signature
MAction<TInteractor> Oculus.Interaction.Interactable< TInteractor, TInteractable >.WhenInteractorRemoved
WhenSelectingInteractorAdded : MAction< TInteractor >
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.
Signature
MAction<TInteractor> Oculus.Interaction.Interactable< TInteractor, TInteractable >.WhenSelectingInteractorAdded
WhenSelectingInteractorRemoved : MAction< TInteractor >
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.
Signature
MAction<TInteractor> Oculus.Interaction.Interactable< TInteractor, TInteractable >.WhenSelectingInteractorRemoved

Static Fields

Registry : InteractableRegistry< TInteractor, TInteractable >
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.
Signature
InteractableRegistry<TInteractor, TInteractable> Oculus.Interaction.Interactable< TInteractor, TInteractable >.Registry

Properties

Data : object
[Get]
Implementation of IInteractableView.Data; for details, please refer to the related documentation provided for that interface.
Signature
object Oculus.Interaction.Interactable< TInteractor, TInteractable >.Data
MaxInteractors : int
[Get][Set]
Implementation of IInteractableView.MaxInteractors; for details, please refer to the related documentation provided for that interface.
Signature
int Oculus.Interaction.Interactable< TInteractor, TInteractable >.MaxInteractors
MaxSelectingInteractors : int
[Get][Set]
Implementation of IInteractableView.MaxSelectingInteractors; for details, please refer to the related documentation provided for that interface.
Signature
int Oculus.Interaction.Interactable< TInteractor, TInteractable >.MaxSelectingInteractors
State : InteractableState
[Get]
Implementation of IInteractableView.State; for details, please refer to the related documentation provided for that interface.
Signature
InteractableState Oculus.Interaction.Interactable< TInteractor, TInteractable >.State

Events

WhenInteractorViewAdded : Action< IInteractorView >
Implementation of IInteractableView.WhenInteractorViewAdded; for details, please refer to the related documentation provided for that interface.
Signature
Action<IInteractorView> Oculus.Interaction.Interactable< TInteractor, TInteractable >.WhenInteractorViewAdded
WhenInteractorViewRemoved : Action< IInteractorView >
Implementation of IInteractableView.WhenInteractorViewRemoved; for details, please refer to the related documentation provided for that interface.
Signature
Action<IInteractorView> Oculus.Interaction.Interactable< TInteractor, TInteractable >.WhenInteractorViewRemoved
WhenSelectingInteractorViewAdded : Action< IInteractorView >
Implementation of IInteractableView.WhenSelectingInteractorViewAdded; for details, please refer to the related documentation provided for that interface.
Signature
Action<IInteractorView> Oculus.Interaction.Interactable< TInteractor, TInteractable >.WhenSelectingInteractorViewAdded
WhenSelectingInteractorViewRemoved : Action< IInteractorView >
Implementation of IInteractableView.WhenSelectingInteractorViewRemoved; for details, please refer to the related documentation provided for that interface.
Signature
Action<IInteractorView> Oculus.Interaction.Interactable< TInteractor, TInteractable >.WhenSelectingInteractorViewRemoved
WhenStateChanged : Action< InteractableStateChangeArgs >
Implementation of IInteractableView.WhenStateChanged; for details, please refer to the related documentation provided for that interface.
Signature
Action<InteractableStateChangeArgs> Oculus.Interaction.Interactable< TInteractor, TInteractable >.WhenStateChanged

Protected Methods

Awake ()
Signature
virtual void Oculus.Interaction.Interactable< TInteractor, TInteractable >.Awake()
Returns
void
InteractorAdded ( interactor )
Signature
virtual void Oculus.Interaction.Interactable< TInteractor, TInteractable >.InteractorAdded(TInteractor interactor)
Parameters
interactor: TInteractor
Returns
void
InteractorRemoved ( interactor )
Signature
virtual void Oculus.Interaction.Interactable< TInteractor, TInteractable >.InteractorRemoved(TInteractor interactor)
Parameters
interactor: TInteractor
Returns
void
OnDisable ()
Signature
virtual void Oculus.Interaction.Interactable< TInteractor, TInteractable >.OnDisable()
Returns
void
OnEnable ()
Signature
virtual void Oculus.Interaction.Interactable< TInteractor, TInteractable >.OnEnable()
Returns
void
SelectingInteractorAdded ( interactor )
Signature
virtual void Oculus.Interaction.Interactable< TInteractor, TInteractable >.SelectingInteractorAdded(TInteractor interactor)
Parameters
interactor: TInteractor
Returns
void
SelectingInteractorRemoved ( interactor )
Signature
virtual void Oculus.Interaction.Interactable< TInteractor, TInteractable >.SelectingInteractorRemoved(TInteractor interactor)
Parameters
interactor: TInteractor
Returns
void
SetRegistry ( registry )
Signature
virtual void Oculus.Interaction.Interactable< TInteractor, TInteractable >.SetRegistry(InteractableRegistry< TInteractor, TInteractable > registry)
Parameters
registry: InteractableRegistry< TInteractor, TInteractable >
Returns
void
Start ()
Signature
virtual void Oculus.Interaction.Interactable< TInteractor, TInteractable >.Start()
Returns
void

Methods

AddInteractor ( interactor )
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.
Signature
void Oculus.Interaction.Interactable< TInteractor, TInteractable >.AddInteractor(TInteractor interactor)
Parameters
interactor: TInteractor
Returns
void
AddSelectingInteractor ( interactor )
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.
Signature
void Oculus.Interaction.Interactable< TInteractor, TInteractable >.AddSelectingInteractor(TInteractor interactor)
Parameters
interactor: TInteractor
Returns
void
CanBeSelectedBy ( interactor )
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.
Signature
bool Oculus.Interaction.Interactable< TInteractor, TInteractable >.CanBeSelectedBy(TInteractor interactor)
Parameters
interactor: TInteractor  The interactor that intends to interact with the interactable.
Returns
bool  True if the interactor can interact with the interactable, false otherwise.
Disable ()
Implementation of IInteractable.Disable; for details, please refer to the related documentation provided for that interface.
Signature
void Oculus.Interaction.Interactable< TInteractor, TInteractable >.Disable()
Returns
void
Enable ()
Implementation of IInteractable.Enable; for details, please refer to the related documentation provided for that interface.
Signature
void Oculus.Interaction.Interactable< TInteractor, TInteractable >.Enable()
Returns
void
HasInteractor ( interactor )
Determines if the interactable is being hovered by the given interactor.
This is a convenience method identical to calling the Contains() method on Interactors.
Signature
bool Oculus.Interaction.Interactable< TInteractor, TInteractable >.HasInteractor(TInteractor interactor)
Parameters
interactor: TInteractor  The interactor to check for hovering.
Returns
bool  True if the interactor is hovering the interactable, false otherwise.
HasSelectingInteractor ( interactor )
Determines if the interactable is being selected by the given interactor.
This is a convenience method identical to calling the Contains() method on SelectingInteractors.
Signature
bool Oculus.Interaction.Interactable< TInteractor, TInteractable >.HasSelectingInteractor(TInteractor interactor)
Parameters
interactor: TInteractor  The interactor to check for selecting.
Returns
bool  True if the interactor is selecting the interactable, false otherwise.
InjectOptionalData ( data )
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.
Signature
void Oculus.Interaction.Interactable< TInteractor, TInteractable >.InjectOptionalData(object data)
Parameters
data: object
Returns
void
InjectOptionalInteractorFilters ( interactorFilters )
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.
Signature
void Oculus.Interaction.Interactable< TInteractor, TInteractable >.InjectOptionalInteractorFilters(List< IGameObjectFilter > interactorFilters)
Parameters
interactorFilters: List< IGameObjectFilter >
Returns
void
RemoveInteractor ( interactor )
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.
Signature
void Oculus.Interaction.Interactable< TInteractor, TInteractable >.RemoveInteractor(TInteractor interactor)
Parameters
interactor: TInteractor
Returns
void
RemoveInteractorByIdentifier ( id )
Implementation of IInteractable.RemoveInteractorByIdentifier(int); for details, please refer to the related documentation provided for that interface.
Signature
void Oculus.Interaction.Interactable< TInteractor, TInteractable >.RemoveInteractorByIdentifier(int id)
Parameters
id: int
Returns
void
RemoveSelectingInteractor ( interactor )
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.
Signature
void Oculus.Interaction.Interactable< TInteractor, TInteractable >.RemoveSelectingInteractor(TInteractor interactor)
Parameters
interactor: TInteractor
Returns
void