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

IInteractable Interface

An IInteractable represents a target for user intent and agency in a transitive interaction.
For example, a PokeInteractable is the aspect of something in the experience which allows it to be interacted with by poking it. Individual conceptual "objects" can have many different IInteractable aspects: a virtual smartphone, for example, might have a PokeInteractable allowing its touchscreen to be poked as well as a GrabInteractable allowing it to be picked up and manipulated. IInteractable is one of the most fundamental concepts of the Interaction SDK.
Despite its conceptual centrality, you should not directly invoke the Enable/Disable methods defined on the IInteractable interface. These APIs are intended for internal use within Interaction SDK core logic. You should not modify MaxInteractors or MaxSettingInteractors while interactions are ongoing. You should not use RemoveInteractorByIdentifier as that can cause unintended side effects; instead, remove them by interacting with the GameObject or Monobehaviour.

Properties

Gets or sets the maximum number of interactors which may simultaneously interact with this interactable.
This API is intended both for core logic and for general use; however, modifying this value while interactions are ongoing is not supported and may result in unexpected behavior.Note: because InteractableState.Hover as well as InteractableState.Select are considered to be states of interaction, changing this value can have subtle consequences. As an example, GrabInteractables can be configured so that they can only be grabbed by one hand at a time, but that is not done by setting this property to 1. (For information about constraining the number of simultaneous grabs, see Grabbable.MaxGrabPoints.) Setting this property to 1 will prevent two simultaneous grabs, but it will also prevent "hand-off" (where something grabbed in one hand can be grabbed with the other hand, whereupon it ceases to be grabbed by the first hand so that it can be grabbed by the second) because grabbing is a selection action which cannot be invoked except from an interactor-interactable relationship which is already in a "hover" (InteractorState.Hover and InteractableState.Hover) state. Because a MaxInteractors value of 1 prevents any more than one interactor from entering any interaction state with this interactable, an interactable which has this value and is already being selected cannot even be hovered, and thus cannot be selected, by any other interactors. Nuances such as this can be tricky to debug, so caution should be exercised when modifying MaxInteractors and similarly fundamental properties.
Gets or sets the maximum number of interactors which may simultaneously select this interactable.
This API is intended both for core logic and for general use; however, modifying this value while interactions are ongoing is not supported and may result in unexpected behavior.

Member Functions

Ensures that the neccessary steps have been performed in order to ready this interactable instance for interaction.
Importantly, this is not the correct mechanism to manually control whether an interactable is active in the scene; you should enable/disable interactables by enabling/disabling MonoBehaviours and GameObjects as appropriate. This API is part of Interaction SDK core logic and should not be invoked outside of core functionality.
Ensures that the neccessary steps have been performed in order to for this interactable to cease interaction.
Importantly, this is not the correct mechanism to manually control whether an interactable is active in the scene; interactable enabling/disabling should be handled by enabling/disabling MonoBehaviours and GameObjects as appropriate. This API is part of Interaction SDK core logic and should not be invoked outside of core functionality.
Causes an interactor which is currently interacting with this IInteractable to cease all interaction.
This is used in core Interaction SDK logic, principally for the purposes of interaction cancellation. This can be used by general logic to force the termination of an ongoing interaction. However, doing this can have hard-to-predict consequences (terminating a "hover" interaction between a GrabInteractor and a GrabInteractable may result in the immediate, same-frame resumption of the same relationship if the interactor is still positioned correctly to hover the interactable, for example) and so caution should be exercised when invoking this method directly. Where possible, it is recommended to directly manage the relationships of interactors and interactables by enabling/disabling interactables at the MonoBehaviour or GameObject level.
Parameters
id
The IInteractorView.Identifier of the interactor to be removed
Did you find this page helpful?
Thumbs up icon
Thumbs down icon