UE5 AI Chase and Forget System
UE5 AI Chase and Forget System
A patrol system is only the beginning of useful enemy AI. Once the enemy can actually detect the player, chase them, and then lose interest after a believable delay, the behavior starts feeling much closer to a real game.
In this tutorial, you will build an enemy chase and forgetting system in Unreal Engine 5 using Blueprints. The enemy will detect the player with AI Perception Sight, increase movement speed when the player is seen, chase them using AI Move To, then forget them after a configurable amount of time and return to patrol.
This episode is important because many developers get the chase part working, but the AI never properly forgets the player. Unreal has a few details here that are easy to miss, especially the project-level setting that allows stale perception targets to actually be forgotten.
Watch the video on YouTube: Unreal Engine 5 Enemy AI #3 – Chasing the Player and Forgetting System
GitHub project: AIUnreal on GitHub
Subscribe for more Unreal Engine tutorials: Rambod YouTube Channel
What You Will Build
- An enemy that sees the player using AI Perception Sight
- Chase behavior triggered when the player is detected
- A faster chase speed than normal patrol speed
- A forgetting system based on Max Age
- Project settings that allow stale actors to be forgotten
- Logic that returns the enemy to patrol after losing the player
- Debug output to confirm when the AI forgets the target
Why Chase and Forgetting Matter
An enemy that only patrols is predictable. An enemy that chases forever is annoying and usually broken. A believable AI needs memory, but only for a limited time.
Good chase behavior does three important things:
- punishes the player for getting seen
- creates tension during escape
- eventually resets so the game can continue
If the enemy instantly forgets the player, the AI feels dumb. If it never forgets the player, the AI feels unfair or bugged. The sweet spot is a short memory window that supports gameplay.
How This System Works
The full behavior flow looks like this:
- The enemy patrols at a normal walk speed.
- AI Perception Sight detects the player.
- The enemy increases speed and uses AI Move To to chase the player.
- If the player escapes vision, the enemy keeps the target in memory for a short time.
- After the memory timer expires, the target is forgotten.
- The enemy slows back to patrol speed and returns to the patrol route.
Most of the logic is straightforward. The part that catches people is the forgetting setup, because Max Age alone is not enough unless Unreal is also allowed to forget stale actors.
Step 1: Tune AI Sight for Real Gameplay
Open your enemy Blueprint, such as:
BP_EnemyGuard
Select the AI Perception component.
In the Sight configuration, adjust the values to something more believable for gameplay instead of leaving huge default vision values.
Example settings:
- Sight Radius: 600
- Lose Sight Radius: 800
- Peripheral Vision Half Angle: 60
- Max Age: 5
These numbers are not universal, but they are a solid starting point for a third-person project.
What These AI Sight Values Actually Mean
Sight Radius
This is how far the enemy can initially detect the player.
Lose Sight Radius
This is slightly larger than the main sight radius so the AI does not instantly lose the target the moment the player crosses the normal vision boundary.
Peripheral Vision Half Angle
This defines how wide the enemy’s field of view is in front of them. A smaller value makes it easier to sneak up from the side or behind.
Max Age
This is the important memory value. It controls how long the stimulus stays valid after perception is lost.
Important Unreal Gotcha: Max Age Alone Is Not Enough
This is where many people get confused.
Setting Max Age does not automatically guarantee that your Blueprint forgetting flow will behave the way you expect unless Unreal is also allowed to actually forget stale actors.
In Blueprint, developers often assume they can constantly read a live stimulus age value and build logic off it directly. That usually leads to confusion.
The correct fix is partly in Project Settings.
Step 2: Enable Forget Stale Actors in Project Settings
Open:
Edit > Project Settings
Scroll to:
Engine > AI System
Find and enable:
Forget Stale Actors
This setting is crucial.
If this is off, your enemy may never truly forget old perception stimuli, which makes the whole chase and forget cycle fail.
Max Age without Forget Stale Actors enabled is one of those Unreal traps that wastes people’s time.
Step 3: Set the Normal Patrol Speed
Still inside the enemy Blueprint, select the Character Movement component.
Set:
- Max Walk Speed: 300
- Max Walk Speed Crouched: 250
This gives the enemy a relaxed patrol speed before they detect the player.
Patrol should look controlled and believable, not like the guard is already in full panic mode.
Step 4: Add the Perception Updated Event
In the enemy Blueprint, select the AI Perception component and go to the Events section.
Add:
On Target Perception Updated
This event fires whenever the AI senses or updates its perception of an actor.
Think of it as Unreal saying:
I just saw something, lost something, or updated what I know about something.
Step 5: Confirm the Detected Actor Is the Player
From the Actor output pin of On Target Perception Updated, cast to your player character Blueprint.
Example:
Cast to BP_ThirdPersonCharacter
This makes sure the enemy only starts the chase logic when the perceived actor is actually the player, not some unrelated sensed actor.
Step 6: Increase the Enemy Speed During the Chase
Drag the Character Movement component into the graph.
From it, call:
Set Max Walk Speed
Set the chase speed to something faster, for example:
500
Connect this after the player cast succeeds.
Now when the enemy detects the player, it immediately switches from patrol speed to chase speed.
Step 7: Move the Enemy Toward the Player
After setting the chase speed, add:
AI Move To
Configure it like this:
- Pawn: Self
- Target Actor: the cast player reference
This tells the enemy to start navigating toward the player using Unreal’s navigation system.
At this point, your enemy should patrol normally, then speed up and chase when the player is seen.
Step 8: Add the Perception Forgotten Event
Next, you need the event that fires when the AI truly forgets the target.
In the AI Perception component Events section, add:
On Target Perception Forgotten
This event is what makes the return-to-patrol behavior possible.
Step 9: Confirm the Forgotten Actor Is the Player
From the Actor output of the forgotten event, cast again to your player character Blueprint.
This verifies that the thing being forgotten is the player and not something else.
Step 10: Restore Patrol Speed
From the Character Movement component, call:
Set Max Walk Speed
Set it back to:
300
This returns the enemy to the normal patrol pace after forgetting the player.
Step 11: Resume the Patrol Logic
After resetting patrol speed, connect the logic back into your patrol system.
In the example setup, that means calling the same logic used at the start to choose the next patrol point, such as:
Get All Actors With Tag
and whatever movement chain you already use for patrol routing.
The idea is:
Enemy forgets player → slow down → restart patrol flow
Step 12: Bind the Forgotten Dispatcher Properly
Here is another detail people often miss.
Depending on your setup, you may need to explicitly assign or bind the perception forgotten event dispatcher.
If needed, add:
Assign On Target Perception Forgotten
and connect it from Begin Play using the AI Perception component as the target.
Then connect the event pin to the custom forgetting event logic.
If you do not wire this correctly, the forgetting logic may never fire even though the settings look correct.
Step 13: Add a Debug Message
For debugging, add:
Format Text
with something like:
AI forgot this {actor}
Then connect that into:
Print String
This gives you immediate visual feedback when the enemy actually forgets the player.
During AI work, debug messages are not optional. They save you from wasting time guessing.
How the Full Chase Logic Works
The chase flow is:
- AI Perception updates.
- The enemy confirms the perceived actor is the player.
- The enemy increases movement speed.
- The enemy uses AI Move To toward the player.
That gives you the active pursuit behavior.
How the Full Forget Logic Works
The forgetting flow is:
- The player escapes sight.
- The sight stimulus remains in memory for Max Age seconds.
- Forget Stale Actors allows Unreal to drop the old stimulus.
- On Target Perception Forgotten fires.
- The enemy slows back down.
- The enemy returns to patrol logic.
This is what makes the AI feel believable instead of permanently locked into chase mode.
Important Debugging Tip: Re-add Blueprint Actors After Major Changes
Unreal sometimes behaves badly with placed Blueprint actors after project settings or perception changes. If your enemy logic seems stuck or refuses to update correctly, try deleting the existing AI actors in the level and dragging in fresh instances of the Blueprint.
Then reapply any required tags such as:
path1
path2
for the patrol setup.
It is ugly, but sometimes Unreal caches enough stale editor state that replacing the actors is the fastest fix.
Important Debugging Tip: Clear Cached Project Data
If the AI still behaves strangely after replacing actors, close Unreal and try deleting the project’s:
- Intermediate
- DerivedDataCache
folders.
Unreal will rebuild them.
This can help if old cached data is causing Blueprint behavior to feel stuck or inconsistent.
Do not do this every five minutes like a ritual, but when the project clearly acts cursed, it is a valid troubleshooting step.
Testing the Final AI Behavior
Once everything is connected:
- run the game
- enter the enemy’s vision cone
- watch the enemy speed up and chase you
- run away until the enemy loses sight
- wait for the 5-second Max Age window
- confirm the enemy slows down and resumes patrol
If your player movement speed is faster than the enemy chase speed, you should be able to escape and force the forget logic to trigger.
Visualizing AI Perception
Unreal’s AI debugger can help you visualize what the enemy sees.
In many setups, pressing:
apostrophe key
and then:
numpad 4
enables parts of the AI visualizer.
Sometimes in specific Unreal versions the debugger may not show perfectly for every actor, but it is still useful for checking whether the sight setup broadly works.
Common Problem: The Enemy Chases but Never Forgets
If the enemy chases correctly but never returns to patrol, check these first:
- Is Forget Stale Actors enabled in Project Settings?
- Is Max Age set to a useful value?
- Is the forgotten event wired correctly?
- Did you bind the dispatcher if your setup requires it?
- Are you sure the enemy actually lost sight of the player?
Most of the time, forgetting failures are caused by one of these details.
Common Problem: The Enemy Never Starts Chasing
If the enemy never chases:
- check the AI Sight values
- check the cast to the player character
- check the AI Move To target
- check that a NavMesh exists in the level
- check that the enemy has a valid AI controller
No NavMesh means no pathing. That is still one of the most common basic AI mistakes.
Common Problem: The Enemy Keeps Reacquiring the Player
If the enemy seems to forget, then instantly re-enter chase mode, the player may still be inside the sight system somewhere, or another part of your setup may be continuously re-triggering perception.
Check:
- line of sight
- sight radius and lose sight radius
- obstacles between player and enemy
- whether the player is actually fully outside vision
Why This System Is a Strong Foundation
This chase and forget behavior is not the final version of enemy AI, but it is an important foundation.
Once it works, you can build on top of it with:
- hearing and distractions
- suspicion states
- alert states
- search behavior
- attack ranges
- behavior trees and blackboards
- group coordination
But if this core chase-forget cycle is broken, every advanced system built on top of it becomes harder to trust.
Conclusion
In this tutorial, you configured AI Sight for more believable gameplay, enabled Forget Stale Actors, created chase logic with AI Move To, raised the enemy’s movement speed during pursuit, and built forgetting logic that restores patrol after the player escapes and the perception memory expires.
This gives you a much more useful enemy AI foundation than simple patrol behavior alone.
Watch the full tutorial on YouTube: Unreal Engine 5 Enemy AI #3 – Chasing the Player and Forgetting System
Subscribe for more Unreal Engine tutorials: Subscribe to Rambod on YouTube
Resources
Frequently Asked Questions
How do I make an AI chase the player in Unreal Engine 5?
Use AI Perception Sight to detect the player, then trigger AI Move To with the player as the target actor and optionally increase the enemy’s movement speed during pursuit.
Why does my AI never forget the player?
A common reason is that Forget Stale Actors is not enabled in Project Settings, or Max Age is not configured properly.
What does Max Age do in AI Perception?
Max Age defines how long a perception stimulus remains in memory after the AI loses direct sensing of the target.
Why is Lose Sight Radius larger than Sight Radius?
It prevents the AI from instantly dropping the target the moment the player leaves the main sight radius, which makes the behavior feel more natural.
Why should patrol speed and chase speed be different?
Different speeds make the enemy behavior easier to read. Patrol should feel calm, while chase should feel urgent.
What should I do if Blueprint AI changes seem stuck?
Try deleting placed AI actors and re-adding fresh instances. If that fails, close Unreal and clear the Intermediate and DerivedDataCache folders so the project rebuilds cleanly.
Continue Unreal Engine 5 Enemy AI Series – Beginner Blueprint Tutorials
Back to Unreal Engine 5 Enemy AI Series – Beginner Blueprint Tutorials playlist • Lesson 3 of 12
Recommended resource
Recommended for this tutorial
Useful tools selected for this workflow topic.