Damageable Object
The EnemyMassesDamageableObject component allows any GameObject in your scene to receive damage from Enemy Masses agents. This is ideal for destructible props, doors, switches, objectives, or any interactive element that enemies should be able to attack.

Overview
This component implements the IEnemyMassesDamageable interface, making it compatible with the Enemy Masses targeting and damage system. When agents detect and attack an object with this component, it will take damage, trigger events, and optionally be destroyed or disabled.
When to Use
Use the Damageable Object component when you want:
Destructible Props
Barrels, crates, furniture that enemies can break
Breakable Doors
Doors that enemies can attack and destroy to pass through
Objective Targets
Defend objectives that enemies try to destroy
Switches/Buttons
Interactive elements that change state when damaged enough
Barriers
Walls or barricades that enemies can break down
This component is for non-agent objects only. For damageable characters or NPCs that are part of the Enemy Masses crowd system, use the built-in agent health system instead.
Setup
Adding the Component
Select the GameObject you want to make damageable
In the Inspector, click Add Component
Search for "Damageable Object" or navigate to Enemy Masses → Damageable Object
Required Setup
The GameObject (or its children) must have at least one Collider for agents to detect and target it
Ensure the object is on a layer that Enemy Masses agents can target
Inspector Properties
Health Settings
Max Health
The maximum health value. The object starts with this amount.
Destroy On Death
If enabled, the entire GameObject is destroyed when health reaches zero.
Disable Colliders On Death
If enabled, all colliders on this object and its children are disabled on death. Useful for preventing further interactions.
Disable Renderers On Death
If enabled, all renderers on this object and its children are disabled on death. Useful for making the object "disappear" without destroying it.
Deactivate On Death
An array of GameObjects to deactivate when the object dies. Useful for hiding specific parts or triggering visual changes.
Events
On Damaged (float, float)
Invoked whenever the object takes damage. Parameters: (currentHealth, maxHealth). Use this to update health bars or trigger damage effects.
On Death
Invoked once when the object's health reaches zero. Use this to trigger death effects, spawn loot, or notify game systems.
Public API
Properties
Methods
Examples
Example 1: Destructible Barrel
A barrel that explodes when destroyed:
Add the Damageable Object component to your barrel prefab
Set Max Health to
50Enable Destroy On Death
Connect your explosion effect to the On Death event
Example 2: Breakable Door
A door that opens (disappears) when destroyed, but the frame remains:
Create a parent GameObject for the door frame
Add the door mesh as a child
Add Damageable Object to the parent
Set Max Health to
100Disable Destroy On Death
Enable Disable Colliders On Death
Add the door mesh to the Deactivate On Death array
Example 3: Objective with Health Bar
A defend objective that shows a health bar:
Add Damageable Object to your objective
Create a UI health bar with a script that has a public method:
Connect this method to the On Damaged event in the Inspector
Custom Damageable Objects
If you need more control, you can create your own damageable objects by implementing the IEnemyMassesDamageable interface:
Tips & Best Practices
Performance Tip: Use Disable Colliders On Death instead of Destroy On Death when possible. This allows you to pool and reuse objects.
Layer Setup: Make sure your damageable objects are on a layer that your Enemy Masses agents are configured to target. Check your agent's targeting settings if objects aren't being attacked.
Multiple Colliders: The component automatically finds all colliders in children. If you only want specific colliders disabled on death, use the Deactivate On Death array to target specific child objects instead.
See Also
IEnemyMassesDamageable Interface - For creating custom damageable implementations
Agent Targeting - How agents select and attack targets
Damage System - Overview of the damage pipeline
Last updated