Quest Enemy Reporter
QuestEnemyReporter.cs
Overview
QuestEnemyReporter attaches to enemy GameObjects and automatically reports their death to the Quest Forge system. When the enemy dies, the component calls QuestEventReporter.Instance.ReportEnemyKilled(...), which updates any active KillObjective objectives that match this enemy's ID.
It natively integrates with Malbers Animal Controller via state change detection and the Malbers Stats component, and also supports OnDestroy, OnDisable, and custom health system detection.

Inspector Properties
Enemy Identification
Identification Type
How the Enemy ID is determined: Tag, Name, or Custom.
Enemy ID
The string identifier sent to the quest system on death. Must match the target ID in the corresponding KillObjective. Shown as read-only when Auto-Detect is enabled.
Auto Detect ID
Automatically populates the Enemy ID from the GameObject's tag or name on Awake. Enabled by default.
Detection Method
Death Detection
How enemy death is detected. See Detection Methods below.
Custom Health Component
The component containing the death event (used by Custom detection).
Death Method Name
The name of the event or method on the Custom Health Component to listen for (e.g. "OnDeath").
Events & Quest Manager
On Enemy Killed
StringEvent fired when this enemy dies. Passes the Enemy ID. Connect to QuestManager.HandleEnemyKilled or use for other game systems.
Use Direct Reference
When enabled, references a specific QuestManager instead of the singleton.
Quest Manager
The QuestManager component reference when Use Direct Reference is enabled.
Advanced Settings
Report Delay
Seconds to wait before reporting death. Useful for syncing with death animations or ensuring other systems resolve first.
Report All Tags
When enabled, reports the GameObject's tag as an additional ID alongside the primary Enemy ID.
Additional IDs
Extra string IDs to report on death. Useful for enemies that should satisfy multiple objective types (e.g. an "Orc" that also counts as "Humanoid").
Debug Options
Debug Mode
Logs detailed death detection and reporting events to the console.
Show Validation Warnings
Enables component validation warnings at startup.
Unlimited Deaths
Allows this enemy to report death multiple times. Useful for respawning enemies or testing. By default, death is only reported once per instance.
Identification Types
Tag
Uses the GameObject's Unity tag as the Enemy ID. Default and recommended. Set the enemy's tag to match your KillObjective target (e.g. Enemy, Orc, Goblin).
Name
Derives the ID from the GameObject's name, stripping (Clone) suffixes and trailing numbers.
Custom
Uses the manually entered Enemy ID string. Auto-detect is ignored for this type.
Detection Methods
MalbersAnimal
Listens to MAnimal.OnStateChange. Reports death when the animal's active state matches the Death state ID. Requires an MAnimal component on the same GameObject.
MalbersStats
Monitors the Health stat via Stats.OnValueChangeNormalized. Reports death when normalized health reaches 0. Requires a Stats component with a stat named "Health".
OnDestroy
Reports death inside Unity's OnDestroy callback — fires when the GameObject is destroyed.
OnDisable
Reports death inside Unity's OnDisable callback — fires when the GameObject is disabled.
Custom
Attempts to bind to a named event on a referenced health component using reflection. Use when integrating with a third-party or custom health system.
Public API
OnEnemyDeath()
Manually triggers death reporting. Can be connected to Unity Events or called from code. Respects the hasReportedDeath guard.
ForceReportDeath()
Resets the reported state and forces a new death report. Useful for respawning enemies.
Reporting Behaviour
When death is detected (after any configured delay), QuestEnemyReporter calls QuestEventReporter.Instance.ReportEnemyKilled(enemyId, gameObject.tag, 1, gameObject).
If no QuestEventReporter is present, it falls back to direct QuestManager calls in this order:
questManager.HandleEnemyKilled(id)— ifUse Direct Referenceis setQuestManager.Instance.HandleEnemyKilled(id)— singleton fallback
The Additional IDs list and Report All Tags option cause multiple calls to fire, allowing a single enemy death to count towards multiple different objective types simultaneously.
Other Notes
The Enemy ID must exactly match the
targetTagorspecificEnemyIdfield on yourKillObjective. It is case-sensitive.The most common and recommended setup is
Identification Type: TagwithAuto Detect IDenabled. Tag your enemy GameObjects with a meaningful identifier (e.g.Wolf,Bandit) and use that same string in yourKillObjective.The custom editor's Status panel in Play Mode shows which active quests require this enemy and provides a Test Report Death button for debugging.
When using
MalbersAnimaldetection, death is detected from theOnStateChangelistener — this requires theMAnimalDeath state to be properly configured on the animal controller.
Last updated