API
Assembly: Spark.Interactables
The Interactables plugin does not expose a central interface. It provides the InteractableObjectEntity component and supporting infrastructure for creating interactive objects in the scene.
InteractableObjectEntity
MonoBehaviour implementing IInteractable. The primary component for interactive objects.
Configuration
displayName
string
Interaction prompt text (default: "Interact")
indicatorYOffset
float
Vertical offset for UI indicator
indicatorDistance
float
Distance at which indicator appears
canInteractDistance
float
Distance at which interaction is possible
interactionRequirements
List<RequirementGroupEntry>
Conditions for interaction
showUIWhenRequirementsNotMet
bool
Show indicator even if requirements fail
canInteractHighlight
GameObject
Highlight object when interactable
onInteractionTriggers
List<TriggerConfiguration>
Triggers executed on interact
allowMultipleInteractions
bool
Can interact more than once
onInteract
UnityEvent
Unity Event callback
State Properties
bool HasInteracted // True if already interacted (one-shot tracking)
bool IsInIndicatorRange // Player is close enough to see indicator
bool IsInInteractRange // Player is close enough to interact
bool IsTargeted // Player is looking at this object
bool MeetsRequirements // All requirements are satisfied
bool CanInteract // Computed: in range, targeted, meets requirements,
// and allows interactionMethods
InteractionEventData
Data passed when an interaction occurs.
InteractableEntity
GameObject
The interactable object
InteractorEntity
GameObject
The player/entity interacting
InteractionTime
float
When the interaction happened
IInteractable
Interface that all interactable objects implement.
Dependencies
The Interactables plugin integrates with:
Triggers Plugin for executing trigger lists on interaction
Requirements Plugin for validating interaction conditions
InteractablesManager for managing UI indicator display and targeting
Usage
Setting Up an Interactable
Add
InteractableObjectEntityto a GameObjectConfigure the display name and distances
Add triggers to
onInteractionTriggersOptionally add requirement groups to restrict interaction
Optionally assign a highlight object
Custom Interactable
Checking Interaction from Code
Last updated
Was this helpful?
