Unreal Engine 5 Enemy AI #3 – Chasing the Player & Forgetting System
Published: August 01, 2025 • Series: Enemy AI Series • Level: beginner
Welcome back to the Unreal Engine 5 Enemy AI Series!
- In Part 1, we created an enemy character with AI Sight.
- In Part 2, we added patrol paths with NavMesh and fixed sliding animations.
- Now in Part 3, we’ll make the enemy chase the player, then forget after a few seconds and return to patrol.
This is one of the most important mechanics for believable AI: enemies shouldn’t chase forever, but they also shouldn’t instantly forget you. We’ll configure Unreal’s AI Perception, tweak project settings, and wire everything in Blueprints only.
🎯 What You’ll Learn
- Fine-tuning AI sight, lose-sight radius, and vision angle
- Understanding Max Age and Unreal’s Forget Stale Actors system
- Making the AI chase the player with increased speed
- Returning to patrol speed when the player is forgotten
- Debugging with print strings and text format
- Fixing “sticky” Blueprint cache issues that can break AI logic
- Visualizing AI vision cones in UE5.6
📝 Chapters
- 00:00 – Intro & What’s Coming
- 01:10 – AI Sight: Configuring Perception
- 02:28 – Max Age & Forgetting Explained
- 03:10 – Project Settings: Forget Stale Actors
- 03:45 – Patrol Speed Setup
- 04:23 – Blueprint: Chasing the Player
- 06:41 – Blueprint: Forget & Resume Patrol
- 08:16 – Binding Forget Events
- 09:54 – Debugging & Troubleshooting Cache Issues
- 10:46 – Fixing Persistent Bugs (Intermediate & Cache Folders)
- 11:27 – Testing in Editor + Visual Debug Tips
- 12:12 – Outro & Next Steps
⚙️ Step 1: Configure AI Perception (Sight)
Open BP_EnemyGuard and select the AI Perception component.
In Details → Sight Config:
- Sight Radius =
600(6m) → balanced detection range. - Lose Sight Radius =
800→ gives AI a buffer before forgetting. - Peripheral Vision Half Angle =
60°→ allows sneaking from behind. - Max Age =
5s→ AI memory span (forget after 5s).
💡 Important Gotcha:
Max Age is not directly readable in Blueprints (it won’t update live). Instead, we rely on Unreal’s internal forget system.
⚙️ Step 2: Enable Forget Stale Actors (Project Settings)
Go to Edit → Project Settings → Engine → AI System.
Enable: Forget Stale Actors ✅
Without this, enemies never truly forget targets, no matter the Max Age. This single setting makes the whole system work.
⚙️ Step 3: Patrol Speed vs. Chase Speed
Select Character Movement component in BP_EnemyGuard:
- Max Walk Speed =
300(patrol speed) - Max Walk Speed Crouch =
250(extra realism if crouching AI)
Later, when chasing the player, we’ll temporarily set this to 500.
⚙️ Step 4: Blueprint – Chasing the Player
- Select AI Perception component → scroll to Events → click On Target Perception Updated (+).
- A new event node appears.
- From Actor pin, drag off → Cast to Player Blueprint (e.g.
BP_ThirdPersonCharacter). - Drag Character Movement component into graph → connect to Set Max Walk Speed = 500.
- Add AI Move To:
- Pawn = Self
- Target Actor = Player cast reference
👉 Now, when AI sees the player:
- Speed increases to
500 - AI runs towards player
⚙️ Step 5: Blueprint – Forgetting the Player
- Select AI Perception component → On Target Perception Forgotten (+).
- Add event node.
- From Actor pin → Cast to Player Blueprint (same as above).
- Set Max Walk Speed = 300 (return to patrol pace).
- Connect execution to Get All Actors with Tag (patrol logic from Part 2).
⚙️ Step 6: Binding the Forget Event
Unreal doesn’t auto-bind the Forget event.
- Right-click → search Assign On Target Perception Forgotten.
- Place node near Event BeginPlay.
- Connect AI Perception component as target.
- Hook event pin to custom Forget logic.
⚙️ Step 7: Debugging the Forget System
Add debug print:
- After Forget event fires → Format Text node.
- Format string:
AI forgot {Actor}.
- Format string:
- Connect Actor pin.
- Pipe into Print String.
👉 Now when AI forgets the player, you’ll see a message in the viewport and log.
⚠️ Step 8: Troubleshooting AI Bugs
Sometimes AI doesn’t update after changes. Common causes:
Old actors in level
- Delete BP_EnemyGuard instances.
- Drag fresh copies into level.
- Reassign tags (
path1,path2).
Stale cache folders
- Close Unreal.
- Delete
IntermediateandDerivedDataCachefrom project folder. - Reopen project (Unreal rebuilds them).
💡 This fixes 90% of “AI stuck” issues after changing perception or Blueprint logic.
🎥 Testing
- Hit Play.
- Approach AI → it sees you → chase speed (500).
- Run out of sight → after 5 seconds → Forget event fires → AI slows to patrol (300) and resumes route.
- Press ' (apostrophe) + Numpad 4 → open Perception Debugger.
- Green cone shows vision → helps test radius and FOV.
👉 Note: In UE5.6, sometimes only one AI shows in visualizer (quirk). Behavior still works fine.
✅ Summary
By now, your AI can:
- Patrol between points (from Part 2)
- Detect player with AI Perception (Sight)
- Chase player at higher speed (500)
- Forget after 5 seconds → return to patrol speed (300)
- Debug forget events in real time
This is the foundation of believable AI—not too robotic, not too dumb.
📦 Project Files → GitHub Repo
🌐 More Tutorials → rambod.net
💬 Drop questions in comments → I reply to all.
🔔 Subscribe for Part 4: Sound Sensing & Chasing Upgrades
📺 Watch the full tutorial:
👉 https://www.youtube.com/watch?v=1U19AJxCpNw