Quest Collectable
QuestCollectable.cs
Overview
QuestCollectable is a bridge component that connects physical world items to the Quest Forge collection tracking system. When an item is collected — via interaction, physical pickup, trigger zone, or manual call — this component reports the event to QuestEventReporter, which updates any active CollectObjective objectives.
Add this component alongside your existing item pickup logic. It does not replace MInteract or Pickable; it listens to their events and translates them into quest system signals.

Inspector Properties
Collection Mode
Collection Mode
Defines how this item is collected. See Collection Modes below.
Item Identification
Identification Type
How the Item ID is determined. See Identification Types below.
Item ID
The string identifier sent to the quest system. Must exactly match the itemId defined in the corresponding CollectObjective.
Item ID From Int
Optional IntReference used to derive the item ID (for inventory system integration). Used with IntVarReference identification type.
Auto Detect ID
When enabled, the Item ID is derived automatically at runtime using the chosen Identification Type.
Collection Settings
Quantity
How many items this single pickup represents. Defaults to 1.
Report Only Once
Prevents this component from reporting more than once. Recommended for non-respawning items.
Report Delay
Seconds to wait before reporting to the quest system. Useful to sync with animations or effects.
Trigger Settings (TriggerCollision mode only)
Collector Tag
The Unity tag of the GameObject that can collect this item (default: Player).
Destroy On Collect
Destroys the GameObject after collection in TriggerCollision mode.
Destroy Delay
Seconds to wait before destroying, allowing effects to complete.
Malbers Integration
MInteract
Reference to the MInteract component. Auto-detected if not assigned.
Pickable
Reference to the Pickable component. Auto-detected if not assigned.
Auto Subscribe
Automatically subscribes to MInteract.OnInteractWithGO or Pickable.OnPicked events on Start.
Quest Requirements
Require Active Quest
When enabled, collection is only permitted if the specified quest is currently active.
Required Quest
The Quest ScriptableObject that must be active for collection to be allowed.
Blocked Message
A message logged to the console when collection is blocked. Can be extended to drive UI prompts.
Events
On Collected
UnityEvent<GameObject>
Fired when the item is successfully collected. Passes the collecting GameObject.
On Collection Blocked
UnityEvent
Fired when collection is attempted but blocked due to quest requirements not being met.
On Pre Report
UnityEvent
Fired just before the collection is reported to the quest system.
Visual Feedback
Collect Effect
A ParticleSystem played on collection.
Collect Sound
An AudioClip played on collection.
Audio Source
The AudioSource used for playback. Auto-created if a collect sound is assigned but no source exists.
Collection Modes
MInteract
Listens to the OnInteractWithGO event from a MInteract component on the same GameObject. The player must interact using the Malbers interaction system.
Pickable
Listens to the OnPicked event from a Pickable component on the same GameObject. The item is collected when physically picked up.
TriggerCollision
Uses OnTriggerEnter / OnTriggerEnter2D. The item is collected when the player walks into the collider zone. Requires a Collider with Is Trigger enabled.
Manual
Does not subscribe to any automatic events. Call Collect() from your own scripts or Unity Events.
Identification Types
Custom
Uses the string value entered in the Item ID field directly.
GameObjectName
Derives the ID from the GameObject's name, stripping (Clone) suffixes and trailing numbers (e.g. Potion 1 → Potion).
GameObjectTag
Uses the GameObject's Unity tag as the ID. Falls back to the Custom ID if the tag is Untagged.
IntVarReference
Uses the integer value from an IntReference ScriptableObject, converted to string. Falls back to Custom ID if no reference is assigned.
Public API
Collect(GameObject collector)
Collects the item and reports to the quest system. Pass the collecting GameObject for event data.
Collect()
Collects the item without specifying a collector. Suitable for Unity Events.
ForceCollect(GameObject collector)
Resets the collected state and collects again, even if already collected.
ResetCollectedState()
Resets the HasBeenCollected flag, allowing the item to be collected again (for respawning).
SetItemId(string newId)
Changes the Item ID at runtime.
SetQuantity(int newQuantity)
Changes the quantity value reported to the quest system at runtime.
Properties (Read-Only)
ItemId
The resolved Item ID used at runtime.
Quantity
The quantity this pickup represents.
HasBeenCollected
Whether this item has already been collected.
CanCollect
Whether collection is currently permitted (not yet collected, and quest requirements met).
Mode
The current CollectionMode setting.
How Reporting Works
When collection is confirmed, QuestCollectable calls:
This sends the Item ID and quantity to the QuestEventReporter, which broadcasts the event to all active quest instances. Any CollectObjective whose itemId matches the reported ID will increment its collected count by the specified quantity.
The full flow is:
Collection is triggered (via
MInteract,Pickable, trigger collision, or manualCollect()call)CanCollectis evaluated — checkshasBeenCollectedand any active quest requirementIf blocked,
OnCollectionBlockedfires and the blocked message is loggedIf permitted and
Report Only Onceis enabled,hasBeenCollectedis set totrueCollection effects play (particle system, audio)
OnPreReportfiresAfter any configured delay,
QuestEventReporter.Instance.ReportItemCollected(itemId, quantity)is calledOnCollectedfires, passing the collecting GameObjectIf mode is
TriggerCollisionandDestroy On Collectis enabled, the GameObject is destroyed after the configured delay
Other Notes
The Item ID set here must exactly match the
itemIdfield on the correspondingCollectObjectivein your Quest ScriptableObject. Case-sensitive.This component relies on
QuestEventReporter.Instance. If noQuestEventReporteris present in the scene (as part ofQuestForgeManagers), collection events will not be reported and a warning will be logged.Destruction of the item after collection in
TriggerCollisionmode is handled by this component. InMInteractandPickablemodes, the items are typically managed by those systems —destroyOnCollectis not applied to those modes.
Last updated