Class Interactable
World object that the player can interact with, exposing up to
OPTIONS_COUNT_MAX labelled choices and gating interaction on proximity and
on-screen visibility.
public class Interactable : MonoBehaviour
Inheritance
Remarks
The design separates what can be interacted with (this component's options) from who is
near it (InteractionArea + Interactor). This means the same
Interactable can work with different interaction ranges per object without
changing the options — the area size in the Inspector controls range.
Visibility gating (via visibilityColliders) prevents the interaction UI from appearing when the object is behind the player or occluded — participants can only interact with what they can actually see.
Options are hard capped at four (OPTIONS_COUNT_MAX) to match the maximum number of on-screen input prompts the UI can display simultaneously.
Fields
options
Array of available interaction options for this interactable.
[Header("INTERACTABLE OPTIONS")]
[Tooltip("List of interaction options available for this object (maximum 4).")]
public InteractableOption[] options
Field Value
Remarks
These options are presented when the interactor can interact with the interactable. Each interactable can have a maximum of 4 options.
Properties
HasVisibilityBounds
Returns true if any visibility colliders are assigned.
public bool HasVisibilityBounds { get; }
Property Value
bool
IsInteractable
Returns true if there are any interaction options available to interact.
public bool IsInteractable { get; }
Property Value
bool
VisibilityBounds
Get the combined bounds of all visibility colliders.
public Bounds VisibilityBounds { get; }
Property Value
Methods
GetInteractionDuration(int)
Gets the interaction duration for the given option index.
public float GetInteractionDuration(int index)
Parameters
| Name | Type | Description |
|---|---|---|
index | int | Index of the interaction option. |
Returns
float — Duration of the interaction, or 0 if unavailable.
InvokeInteractionCancel(int)
Triggers the interaction cancel event for the given option index.
public void InvokeInteractionCancel(int index)
Parameters
| Name | Type | Description |
|---|---|---|
index | int | Index of the interaction option. |
InvokeInteractionComplete(int)
Triggers the interaction complete event for the given option index.
public void InvokeInteractionComplete(int index)
Parameters
| Name | Type | Description |
|---|---|---|
index | int | Index of the interaction option. |
InvokeInteractionStart(int)
Triggers the interaction start event for the given option index.
public void InvokeInteractionStart(int index)
Parameters
| Name | Type | Description |
|---|---|---|
index | int | Index of the interaction option. |
InvokeInteractionUpdate(int)
Triggers the interaction update event for the given option index.
public void InvokeInteractionUpdate(int index)
Parameters
| Name | Type | Description |
|---|---|---|
index | int | Index of the interaction option. |
IsInteractionAutoComplete(int)
Returns whether the interaction should auto-complete for the given option index.
public bool IsInteractionAutoComplete(int index)
Parameters
| Name | Type | Description |
|---|---|---|
index | int | Index of the interaction option. |
Returns
bool — True if auto-complete is enabled, false otherwise.
TryGetOption(int, out InteractableOption)
Retrieve the interaction option by the given index, if it exist.
public bool TryGetOption(int index, out InteractableOption option)
Parameters
| Name | Type | Description |
|---|---|---|
index | int | Index of the interaction option. |
option | InteractableOption | The output argument that will contain the retriveved option or default. |
Returns
bool — Return true if the option was retrieved, false otherwise.
OptionsChanged
Raised whenever options is replaced, so observers can refresh anything derived from the option list.
public event Action OptionsChanged
Event Type
Remarks
Completion policies such as ConsumeSelf mutate the option array while the interactable remains active. Without this notification the interaction UI would keep displaying prompts for options that no longer exist.