# My Unreal Engine StateTree AI incorrectly clears its player target while the player is still within sight, causing the AI to leave Chase and return to Patrol. 

**URL:** <https://forums.unrealengine.com/t/my-unreal-engine-statetree-ai-incorrectly-clears-its-player-target-while-the-player-is-still-within-sight-causing-the-ai-to-leave-chase-and-return-to-patrol/2834066>\
**Category:** AI\
**Tags:** unreal-engine, bug-report, question, Blueprint\
**Created:** [September 24, 2026, 8:16pm UTC](https://forums.unrealengine.com/t/my-unreal-engine-statetree-ai-incorrectly-clears-its-player-target-while-the-player-is-still-within-sight-causing-the-ai-to-leave-chase-and-return-to-patrol/2834066 "2026-09-24T20:16:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nishanth1445](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nishanth1445](https://forums.unrealengine.com/u/Nishanth1445)\
**Post date:** [September 24, 2026, 8:16pm UTC](https://forums.unrealengine.com/t/my-unreal-engine-statetree-ai-incorrectly-clears-its-player-target-while-the-player-is-still-within-sight-causing-the-ai-to-leave-chase-and-return-to-patrol/2834066/1 "2026-09-24T20:16:18Z")

</div>

Hello, I am working on state tree AI and i am having a issue with the states. The ai patrols and when it sense the player it should chase the player and get back to patrol if the chase fails(when the player is out of sight) but im facing issue  
i am using ai perception component and added 3 senses, sight, hear and damage  
so when the player is within the sight radius of the ai it stores the player ref as target actor and then the chase fucntion calls here and the ai should follow the target  
and when the player is not within the sight radius the target actor ref is cleared but in my game when the player is within the sight radius it first detects the player and stores the actor but within few seconds or after sometimes it gets cleared even tho the ai is in chase and seeing the player and it gets back to patrol  
so i need help with it  
so like even if the player is within sight it fails to detect in chase  
I have attached the video clip here: [https://drive.google.com/file/d/15O\_kqP9VuQM7DgkdL690p0ST1hLh5Mel/view?usp=sharing](https://drive.google.com/file/d/15O_kqP9VuQM7DgkdL690p0ST1hLh5Mel/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![James.Keeling](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James.Keeling](https://forums.unrealengine.com/u/James.Keeling)\
**Post date:** [October 23, 2026, 1:53pm UTC](https://forums.unrealengine.com/t/my-unreal-engine-statetree-ai-incorrectly-clears-its-player-target-while-the-player-is-still-within-sight-causing-the-ai-to-leave-chase-and-return-to-patrol/2834066/2 "2026-10-23T13:53:01Z")

</div>

I would be open to helping, but I am not allowed to open various links on here. Can you post it as a video clip or screenshots of the project where things go wrong? Have you used the Rewind Debugger to trace what is happening inside the StateTree’s logic each frame when this is reset? Is there a task that completes early and causes a transition?

-James

---

<div class="post-metadata">

**Author:** ![Nishanth1445](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nishanth1445](https://forums.unrealengine.com/u/Nishanth1445)\
**Post date:** [October 24, 2026, 5:01am UTC](https://forums.unrealengine.com/t/my-unreal-engine-statetree-ai-incorrectly-clears-its-player-target-while-the-player-is-still-within-sight-causing-the-ai-to-leave-chase-and-return-to-patrol/2834066/3 "2026-10-24T05:01:57Z")

</div>

I tried posting the video but it doesnt allow me to, also yeah I have checked everything but none shows what’s the actual problem.

-Nishanth

---

<div class="post-metadata">

**Author:** ![James.Keeling](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@James.Keeling](https://forums.unrealengine.com/u/James.Keeling)\
**Post date:** [October 26, 2026, 2:07pm UTC](https://forums.unrealengine.com/t/my-unreal-engine-statetree-ai-incorrectly-clears-its-player-target-while-the-player-is-still-within-sight-causing-the-ai-to-leave-chase-and-return-to-patrol/2834066/4 "2026-10-26T14:07:53Z")

</div>

Can you share the screenshot of the Rewind Debugger or VisLog for when the behavior starts with perception and when it exits? It should be two frames of data. Also, can you post your StateTree you are using?

Setting up RewindDebugger (RWD) for Mass does mean adding Mass Entity Handle as a **Selector Allowed Struct Types** for RWD in Editor Preferences.
