Interactions

NPC interactions define what happens when a player interacts with an NPC. Each interaction has a type that determines its behavior and data that configures it.

Creating an Interaction Entry

Open the Spark Editor, go to NPCs > Interactions and click Create New.

Each interaction entry defines:

Field
Description

Display Name

Internal name for this interaction.

Interaction Type

The type of interaction (ScriptableObject dropdown). Determines what happens when selected.

Interaction Text

Text shown in the NPC interaction menu (e.g., "Talk", "Trade", "Accept Quest"). Default: "Interact".

Text Color

Color of the interaction text in the menu (default: white).

Interaction Types

Type
Description

Trigger

Executes a trigger entry when the player selects this interaction. Configure the trigger entry in the interaction data. Use this for dialogue, cutscenes, rewards, or any trigger-based behavior.

Give Quest

Offers a quest to the player. Configure the quest entry. Only appears if the player hasn't accepted or completed the quest and meets accept requirements. Requires Quests plugin.

Turn In Quest

Allows the player to turn in a completed quest. Configure the quest entry. Only appears if the quest is active or ready to turn in. Requires Quests plugin.

Setting Up an Interactable NPC

To make an NPC interactable, add an InteractableNPCEntity component in the Inspector.

Basic Settings

Field
Description

Display Name

Name shown above the NPC as a nameplate (default: "NPC").

Indicator Y Offset

Height above the NPC where the interaction indicator appears (default: 2).

Indicator Distance

Distance at which the indicator becomes visible (default: 5).

Can Interact Distance

Distance the player must be within to interact (default: 3).

Cursor Settings

Field
Description

Talk Cursor

The cursor to display when hovering over this NPC and interactions are available.

Interaction Settings

Field
Description

Enable Key Interaction

Allow interaction via the interact key (default: true).

Enable Right Click Interaction

Allow interaction via right-click (default: false).

Max Distance

Maximum distance for right-click interaction (default: 10).

Interactions List

Field
Description

Interactions

List of NPC Interaction database entries shown in the interaction menu.

Inline Interactions

Interactions defined directly on this NPC without needing a database entry (scene-specific).

Inline interactions are useful for one-off NPCs that don't need reusable interaction entries. Each inline interaction can either reference a database entry or define its own type, data, text, and color directly.

When the player interacts with the NPC, a menu panel appears showing all available interactions. The NPC automatically faces the player during interaction.

Interactable Objects

For non-NPC interactables (chests, levers, doors, etc.), use the InteractableObjectEntity component instead:

Field
Description

Display Name

Label for this interactable.

Indicator Y Offset

Height for the indicator (default: 1.5).

Indicator Distance

Visibility distance for the indicator (default: 5).

Can Interact Distance

Required distance to interact (default: 3).

Interaction Requirements

Requirement groups that must be met to interact.

Show UI When Requirements Not Met

Show the indicator even when requirements aren't met (default: false).

Can Interact Highlight

A GameObject to activate/deactivate based on interactability.

On Interaction Triggers

List of triggers to execute when interacted with.

Allow Multiple Interactions

If disabled, can only be interacted with once (default: true).

NPC Interaction Panel UI

The NPCInteractionPanel is a singleton UI that displays the interaction menu.

Field
Description

Options Container

Parent transform where interaction option buttons are spawned.

Option Prefab

Prefab for individual interaction buttons.

Close Button

Button to close the panel.

NPC Name Text

TextMeshPro component displaying the NPC's name.

Last updated

Was this helpful?