hand-pointerInteractables

The Interactable Component

Adding an Interactable component to an entity will automatically show UI when player are within the Radius you specify.

To respond to the player pressing the interactable, you'll need to write CSL code.

The most common pattern is:

  • Create a class that inherits from Interactable

  • Call this->set_listener(this) in ao_start

  • Implement can_use and on_interact on your class

circle-info

If you add a new interactable class in code, you still need to add that component to an entity in the editor (or spawn an entity and add the component at runtime).

Trash Example

Grow Example

An interactable that “grows” an entity (once):

Prompt Purchase Example

An interactable that prompts a product purchase:

API Reference

Optional player hooks (global rules)

You can also implement these on your Player class to enforce game-wide rules (e.g. can't use interactables before respawning):

Last updated