UE5 Damageable AI Health Component
A modular health system is only useful if you can reuse it on real gameplay actors. In this tutorial, we connect the reusable Health Component directly to an enemy AI character and make that AI damageable from the weapon shooting system.
This is not Chaos destruction. This is not physics fracture. This is clean gameplay-driven health logic. The AI receives damage from line trace hits, updates a floating health bar in real time, and gets destroyed when health reaches zero.
To follow this properly, you should first complete the modular health component tutorial. Without that foundation, this episode will feel like jumping into the middle of the architecture.
Watch the video on YouTube: Make AI Damageable in Unreal Engine 5 Using a Modular Health Component
GitHub repository: AIUnreal on GitHub
Subscribe for more Unreal Engine tutorials: Rambod YouTube Channel
What You Will Build
- A dedicated Bullet trace channel for weapon logic
- A Health Component attached to an enemy AI Blueprint
- A floating screen-space health bar above the AI
- Event Dispatcher binding through OnHealthChanged
- Real-time health bar updates when the AI takes damage
- Clean AI destruction when health reaches zero
Why This Tutorial Matters
The whole point of a modular Health Component is reuse. If the health system only works on one test cube, it is not enough. It needs to work on AI, players, props, doors, destructible objects, and anything else that can receive damage.
In this episode, the AI does not get custom hardcoded health logic. Instead, we attach the same reusable Health Component and let the AI react to that component’s events.
That is the correct scalable approach.
Step 1: Create a Dedicated Bullet Trace Channel
Before connecting health to the AI, improve the shooting system by creating a dedicated trace channel for weapon fire.
Go to:
Edit > Project Settings
Search for:
Channel
Under Engine Collision, find Trace Channels and create a new trace channel named:
Bullet
Keep the default response set to:
Block
Why Use a Bullet Trace Channel?
Using the Visibility channel for weapon logic works early on, but it is not a great long-term habit. Visibility may also be used for camera checks, interaction logic, UI traces, or other systems.
A dedicated Bullet trace channel separates weapon logic from unrelated systems. That makes the project cleaner and easier to scale.
Step 2: Update the Weapon Line Trace
Open:
ThirdPerson > Blueprints > BP_ThirdPersonCharacter
Find the existing IA_Fire logic and locate the Line Trace by Channel node.
Change the trace channel from Visibility to:
Bullet
If the new channel does not appear immediately, compile once and check the dropdown again.
Compile and save after changing it.
Step 3: Add the Health Component to the Enemy AI
Open your enemy AI Blueprint. In this tutorial, the enemy Blueprint is:
BP_EnemyGuard
In the Components panel, click Add and search for the Health Component created in the previous tutorial:
BP_HealthComponent
Add it to the enemy.
Select the component and set:
HP = 100
MaxHP = 100
HealthPercentage = 1
Now the AI starts at full health using the exact same reusable component as the previous destructible object example.
Step 4: Add a Floating Health Bar Widget
Still inside the enemy Blueprint, add a Widget Component.
Move it above the AI character’s head in the viewport.
In the User Interface section, set:
- Space: Screen
- Widget Class: HealthIndicator
- Draw Size: 100 x 20
Screen space keeps the health bar facing the camera, which is usually easier to read for quick gameplay testing.
Step 5: Bind to OnHealthChanged
Open the Event Graph of BP_EnemyGuard.
From Event Begin Play, add a Sequence node if you need multiple initialization paths.
Drag the Health Component into the graph and search for:
Assign OnHealthChanged
Use Assign, not the wrong direct Bind flow. Assign creates the matching event node cleanly and makes the graph easier to manage.
Step 6: Update the Health Bar When Damage Happens
From the OnHealthChanged event created by Assign, update the health widget.
Drag in the Widget Component and call:
Get Widget
Cast the returned widget to:
HealthIndicator
From the cast result, access:
HealthProgressBar
Then call:
Set Percent
Pull HealthPercentage from the Health Component and connect it to the percent input.
Now every time the AI receives damage, the floating bar updates automatically.
Step 7: Destroy the AI When Health Reaches Zero
From the Health Component, get:
Died
Feed it into a Branch.
If true, call:
Destroy Actor
with the target as self.
For now, instant destruction is fine. Later, this should be replaced with ragdoll, death animation, AI state cleanup, delayed removal, or loot logic.
Important Fix: Use the Generated OnHealthChanged Event
One mistake to avoid is wiring the dispatcher binding directly into the health bar update logic.
That is wrong.
The correct flow is to use the custom OnHealthChanged event that was automatically generated by the Assign node. That event should drive the cast to the widget and progress bar update.
If you wire this incorrectly, the health bar may not update when damage happens.
AI Damage Sense Note
If your AI has an AI Perception Component, you may notice a Damage Sense Config option inside Senses Config.
This episode does not configure AI damage perception yet, but it is worth knowing that Unreal has perception support for damage events. Later, this can be used so AI reacts to being shot, detects the attacker, or changes behavior based on damage.
How the Full AI Damage Flow Works
- The weapon fires using the Bullet trace channel
- The line trace hits the enemy AI
- The existing weapon damage logic finds BP_HealthComponent on the hit actor
- ReceiveDamage runs on the Health Component
- HealthPercentage is updated
- OnHealthChanged broadcasts
- The AI Blueprint updates its floating health bar
- If Died is true, the AI destroys itself
Common Mistakes to Avoid
- Trying to rebuild health logic inside the AI Blueprint
- Forgetting to add BP_HealthComponent to the enemy
- Leaving HP or MaxHP at incorrect values
- Not setting HealthPercentage to 1 at start
- Using Visibility trace forever instead of creating a Bullet channel
- Binding the dispatcher incorrectly instead of using the generated event
- Forgetting to cast the widget before accessing the progress bar
Why This Architecture Scales
This setup is clean because the AI does not own the health logic. The Health Component owns health. The AI only reacts to health changes.
That same component can now be reused on enemies, props, players, doors, destructible objects, or anything else that should take damage.
This is how you avoid duplicated Blueprint garbage.
Conclusion
In this tutorial, you made an Unreal Engine 5 AI character damageable using the modular Health Component system. You created a dedicated Bullet trace channel, attached the Health Component to the enemy Blueprint, added a floating health bar, bound to OnHealthChanged correctly, updated the UI in real time, and destroyed the AI when health reached zero.
This is a clean gameplay-driven damage setup and a solid foundation for future AI death animations, ragdoll, damage perception, and combat behavior.
Watch the full tutorial on YouTube: Make AI Damageable in Unreal Engine 5 Using a Modular Health Component
Subscribe for more Unreal Engine tutorials: Subscribe to Rambod on YouTube
Frequently Asked Questions
How do I make AI damageable in Unreal Engine 5?
Attach a reusable Health Component to the AI Blueprint, call ReceiveDamage from your weapon hit logic, and bind to OnHealthChanged to update UI or handle death.
Why create a Bullet trace channel?
A dedicated Bullet channel keeps weapon traces separate from visibility, camera, interaction, and other unrelated trace logic.
Why use Assign OnHealthChanged instead of direct binding?
Assign creates the correct event flow cleanly and makes it easier to update the UI whenever the Health Component broadcasts a change.
Why does my AI health bar not update?
Common causes include incorrect dispatcher wiring, casting to the wrong widget class, not enabling the progress bar as a variable, or not updating HealthPercentage correctly in the Health Component.
Is this Chaos destruction?
No. This is gameplay-driven health logic. Chaos destruction uses Geometry Collections, physics, strain, and fracture.
Can this system work with players and props too?
Yes. The same Health Component can be attached to players, enemies, props, doors, or any actor that should receive damage.
Continue Unreal Engine 5 Enemy AI Series – Beginner Blueprint Tutorials
Back to Unreal Engine 5 Enemy AI Series – Beginner Blueprint Tutorials playlist • Lesson 12 of 15