Quest Interactable

QuestInteractable.cs

Overview

QuestInteractable is a bridge component that connects Malbers MInteract interaction events to the Quest Forge system. Attach it alongside an MInteract component on any interactable object to enable InteractObjective tracking.

When the player interacts with the object, QuestInteractable reports the interaction to QuestEventReporter using both a type ID (identifying what kind of object it is) and an optional unique instance ID (identifying which specific object was interacted with).


Inspector Properties

Interactable Identification

Property
Description

Identification Type

How the Interactable ID is determined. See Identification Types below.

Interactable ID

The string identifier sent to the quest system when this object is interacted with. Must match the target ID in the corresponding InteractObjective.

Auto Detect ID

When enabled, the ID is derived automatically at runtime from the chosen Identification Type.

Instance Tracking

Property
Description

Use Unique Instance ID

Generates a unique instance ID for this specific object, combining scene name and Unity instance ID. Used to track "interact with X distinct objects" type objectives.

Custom Instance ID

Manually specify an instance ID. Takes priority over auto-generation. Useful for persistent save tracking.

Interaction Settings

Property
Description

Report Only Once

When enabled, the interaction is only reported to the quest system once per component lifetime. When disabled, every interaction is reported.

Report Delay

Seconds to wait before reporting the interaction to the quest system. Useful for syncing with interaction animations.

MInteract Integration

Property
Description

MInteract

Reference to the MInteract component. Auto-detected from the same GameObject if not assigned.

Auto Listen To MInteract

Automatically subscribes to MInteract.OnInteractWithGO on Start. Disable if you intend to call ReportInteraction() manually.


Identification Types

Type
Description

Custom

Uses the manually entered Interactable ID string directly.

MInteractIndex

Uses the Index value from the MInteract component as the ID (converted to string).

GameObjectName

Derives the ID from the GameObject's name, stripping (Clone) and trailing numbers.

GameObjectTag

Uses the GameObject's Unity tag as the ID.


Public API

Method
Description

ReportInteraction()

Manually reports an interaction with interactor ID 0. Can be called from a Unity Event.

ReportInteraction(int interactorId)

Reports an interaction with a specific Malbers MInteractor ID.

ForceReportInteraction(int interactorId)

Resets the reported state and forces a new report, even if already reported.

ResetReportedState()

Resets the HasReported flag, allowing the interaction to be reported again (for reusable interactables).


Properties (Read-Only)

Property
Description

InteractableId

The Interactable ID string used for quest matching.

InstanceId

The unique instance ID for this specific object.

InteractIndex

The cached MInteract.Index value (set on Awake).

HasReported

Whether this interactable has already reported an interaction.


How Reporting Works

When an interaction is detected, QuestInteractable calls QuestEventReporter.Instance.ReportObjectInteracted(...) passing four values:

  • Interactable ID — the type identifier (e.g. "Notice Board", "Shrine")

  • Interact Index — the Malbers MInteract.Index value

  • Instance ID — the unique identifier for this specific object

  • Interactor ID — the Malbers MInteractor.ID of the activating character

The InteractObjective in your Quest ScriptableObject defines whether matching is done by ID, by index, by instance count, or by unique instances — so the data passed here covers all objective configurations.


Notes

  • The QuestInteractable requires a QuestEventReporter in the scene (part of QuestForgeManagers). Without it, interactions will not be tracked and a warning is logged.

  • If Auto Listen To MInteract is enabled but no MInteract component is found, a warning is logged. Ensure the component exists on the same GameObject.

  • The Interactable ID must exactly match the value expected by the InteractObjective. It is case-sensitive.

  • Use Unique Instance ID is important when an objective requires the player to interact with multiple different objects of the same type (e.g. "Activate 3 shrines"). Without unique instance IDs, interacting with the same object multiple times could satisfy the objective.

Last updated