07_DeathFxHandlers — Death FX Handlers¶
Goal¶
Teach the difference between previewing death VFX and running the real HealthSystem death flow.
What This Scene Demonstrates¶
Selected target → HealthSystem lifecycle → HealthDeathEffectHandler → death FX / optional destroy.
This scene shows how a selected target with HealthSystem and HealthDeathEffectHandler can preview death visuals, run the real kill flow, revive, reset health, and optionally destroy the target after death.
PreviewDeathEffects is VFX-only. HealthSystem.Kill() is the real death-flow entry point.
What To Look For¶
- Setup: The panel selects from configured targets and checks for
HealthSystemandHealthDeathEffectHandler. - Death VFX: Offset and lifetime are configured through the handler API.
- Preview FX: Runs death VFX without changing health, firing death events, or destroying the object.
- Kill: Calls
HealthSystem.Kill()and runs the real death lifecycle. - Revive / Reset HP: Revives a dead target or resets a live target to max HP.
- Destroy On Death: Controls whether the object can be destroyed after death FX flow completes.
- Events:
DiedandRevivedevents are listened to and surfaced as panel feedback.
Mental model: HealthSystem owns alive/dead state; HealthDeathEffectHandler owns presentation around death.
Sample Scope¶
This scene covers:
- Selecting between multiple configured targets
- Validating
HealthSystempresence - Validating
HealthDeathEffectHandlerpresence - Death VFX offset
- Death VFX lifetime
- Previewing death VFX without changing health
- Running the real death flow through
HealthSystem.Kill() - Reviving dead targets through
HealthSystem.Revive() - Resetting live targets through
HealthSystem.ResetToMax() - Destroy-on-death toggle through the handler
DiedandRevivedevent feedback- Fallback target selection if the current target is destroyed
This scene does NOT cover:
- Damage rules
- Shields
- Respawn systems
- Pooling systems
- Reward logic
- Production camera/audio/VFX pipelines
- Networking implementation
- Automatic handler creation
Some sample targets may include extra presentation listeners such as camera shake or time slow. Those are sample additions reacting to the same death flow, not required parts of HealthDeathEffectHandler.
Authority Note¶
This scene may include a permissive sample authority setup where mutations are allowed locally for demonstration purposes.
Networking Reminder¶
No networking is included; integration is the developer’s responsibility.
How To Use¶
- Enter Play Mode.
- Open the Setup tab.
- Select a target from the target selector.
-
Confirm the selected target has:
-
HealthSystem HealthDeathEffectHandler-
Check:
-
current target name
- dead state
- destroy-on-death state
- Open the Death VFX tab.
- Adjust Offset to move the spawned death VFX relative to the target.
- Adjust Lifetime to control how long spawned VFX remains before cleanup.
- Open the Actions tab.
- Select the target again if needed.
-
Toggle Destroy On Death:
-
Enabled: object may be destroyed after death FX flow completes
-
Disabled: object remains and can be revived in place
-
Click Preview FX to preview visuals only.
- Click Kill (run flow) to call
HealthSystem.Kill()and run the real death flow. -
Click Revive / Reset HP:
-
If the target is dead, it calls
HealthSystem.Revive() -
If the target is alive, it calls
HealthSystem.ResetToMax() -
Watch the result messages for
DiedandRevivedevent feedback.
Failure Behaviour¶
-
No Targets
-
Meaning: The panel has no configured target list.
-
Fix: Populate the Targets array with at least one target.
-
Missing Selection
-
Meaning: No valid target is selected.
-
Fix: Add targets or select a non-null entry.
-
Missing HealthSystem
-
Meaning: The selected target cannot run death lifecycle actions.
-
Fix: Add
HealthSystemto the target or select another target. -
Missing DeathEffectHandler
-
Meaning: The selected target cannot preview or run handler death FX.
-
Fix: Add
HealthDeathEffectHandlerto the target. -
Death VFX Blocked
-
Meaning: Death VFX controls need a target with both required components.
-
Fix: Return to Setup and fix the target binding.
-
Actions Blocked
-
Meaning: Runtime actions need a valid target with
HealthSystemandHealthDeathEffectHandler. -
Fix: Return to Setup and fix the target binding.
-
Preview FX does not change health
-
Meaning: This is expected; preview is VFX-only.
-
Fix: Use Kill (run flow) if you want the real death lifecycle.
-
Target destroys itself
-
Meaning: Destroy On Death was enabled and the death flow removed the object.
-
Fix: Select another valid target or disable Destroy On Death for repeat revive testing.
-
Revive / Reset HP selects another target
-
Meaning: Current target is missing or destroyed.
- Fix: Use the newly selected valid target or repopulate the Targets array.
Behind The Scenes¶
HealthSystem— owns alive/dead state and lifecycle callsHealthSystem.Kill()— real death-flow entry pointHealthSystem.Revive()— revives a dead targetHealthSystem.ResetToMax()— restores HP to max when target is aliveHealthSystem.Died— event surfaced by the panel when death occursHealthSystem.Revived— event surfaced by the panel when revive occursHealthDeathEffectHandler— handles death FX configuration and optional destroy behaviourHealthDeathEffectHandler.ConfigureDeathVfx(...)— updates VFX prefab, offset, and lifetime settingsHealthDeathEffectHandler.PreviewDeathEffects()— previews VFX without changing health stateHealthDeathEffectHandler.SetDestroyOnDeath(...)— updates destroy-on-death behaviourDeathVFXOffset— current VFX spawn offsetDeathVFXLifetime— current VFX lifetimeDestroyOnDeath— current destroy-on-death state
The panel uses public HealthSystem and HealthDeathEffectHandler APIs only. It does not access internals, use reflection, or fake death/revive events.
Key Takeaway¶
Preview FX is visual-only. Kill runs the real HealthSystem death flow.
HealthSystem decides whether the target is alive or dead. HealthDeathEffectHandler decides what presentation happens around that death moment.
That separation lets death feedback stay modular without stuffing presentation logic into the core health component.