Interactable Target
The Interactable is the central, object-side brain of the interaction system. It defines how an object behaves when a player targets it, manages timing and state changes, and dispatches UnityEvents to mechanical utilities or your custom logic.
Because it handles no raycasting or input polling itself, it maintains zero Update() overhead until actively engaged by an Interactor.
Dynamic Behavior Configurations
The specific settings and output events of an Interactable change entirely based on the chosen Interaction Type. Select a type below to view its specific Inspector UI, parameters, and events.
- Instant
- Hold
- Toggle
- Hold + Toggle
- Push / Pull
- Drag
Fires immediately upon a single button press. Best for simple light switches, item pickups, and basic triggers.
Type-Specific Implementation
The Instant type utilizes standard lifecycle events natively and requires no unique mechanical setup.
Requires the player to continuously hold the input for a set duration before completing. Excellent for heavy valves or actions that require commitment, like lockpicking.
Hold Configuration Settings
Hold Events
Maintains an internal On/Off boolean state. Each press swaps the state and fires the corresponding event. Excellent for flashlights, engine toggles, and power breakers.
Toggle Configuration Settings
Toggle Events
Combines both mechanics. Requires the player to hold the input continuously for a set duration. Upon successful completion, the internal On/Off boolean state flips and the corresponding events fire. Ideal for powering up heavy machinery.
Hold Configuration Settings
Toggle Configuration Settings
Hold Events
Toggle Events
Translates raw mouse/thumbstick movement along a single axis into a clamped float value. Perfect for sliding drawers, throttle levers, and joysticks.
Push / Pull Configuration Settings
Push / Pull Events
Yields raw 2D input deltas and 3D world-space targets directly from the Interactor's raycast. Essential for physics-driven swinging doors, picking up physics rigidbodies, or steering wheels.
Drag Configuration Settings
Drag Events
Global Properties
These variables and events are shared across all interaction types and dictate the foundational behavior of the object in the world.
Core State & Cooldowns
Spatial Anchors & Points
Contextual Prompts
The string text fed to the UI. The system automatically reads the correct prompt based on the object's current state.
Lifecycle Events
Scripting API
You can easily interface with the core Interactable state via C# to drive game logic or override behaviors programmatically.
using MyDreamGameStudio.InteractAnything;
using UnityEngine;
public class CustomTriggerLogic : MonoBehaviour
{
private Interactable interactable;
private void Awake()
{
interactable = GetComponent<Interactable>();
// Listen for standard completion
interactable.OnInteractionComplete.AddListener(HandleInteraction);
}
private void HandleInteraction()
{
Debug.Log("Object was interacted with!");
}
// Example of disabling the object programmatically
public void LockObject()
{
interactable.SetEnabled(false);
}
}