Behavior Tree Stuck in Loop/Flashing

Hello, I’m making a basic shooter game. I want an enemy character that patrols between two waypoints. I made the AI to do this following this video: - YouTube [17:50 - 20:45]

This worked perfectly! The first time I did this the enemy character walked back and forth between the 2 waypoints and would chase me if I was in the predetermined radius. However, I deleted the map/level that I first implemented this AI on. When I created a new level, I imported my enemy character to the level, and assigned the Anim Class to the Enemy AnimBP that I created earlier. I arranged the waypoints and compiled/saved everything. But when I hit simulate/play in viewport, the character does not patrol between the waypoints. And he no longer chases me when I approach him as before. When I watch the Behavior Tree in realtime, I see that it appears in gets stuck in a loop between the “root” node, and the “move to” node pointing at waypoint 1. I do not understand why.

I have attached an image of my Behavior Tree and below is a link to a video that shows the loop/flashing I am describing while trying to simulate/play. Any insight would be greatly appreciated.!

You forgot to add a Nav Volume or your nav mesh needs to be rebuilt

Thank you!!

One more comment I’d like to add, is always have a fallback behavior. All of your leaf nodes are guarded by some conditions, while it’s still possible to fail all of them. If you don’t have a “catch all” fallback behavior your tree will end up cycling every frame wasting a CPU time.

1 Like