Hi - I’m hoping someone can point me in the right direction: I’m following the Behavior Tree in Unreal Engine Quick Start Guide. I’m using UE 5.0.2. I’ve completed it twice in separate projects, but both have the same result in the Behavior Tree: The AI “Enemy” just ‘waits’, flashes on to the ‘Patrol’ sequence for a moment, and then returns to waiting. My hope was that it would revert to ‘Patrol’, find some point in its patrol radius, and move to that point. Even when I pass directly in front of the “Enemy”, I can verify that the AI perception is detecting me (through “Print” messages in the blueprint), but the Enemy isn’t budging.
A screenshot of the behavior tree is pasted below, please let me know if any other information would help troubleshoot this.
Hi, did you check that you have a navmesh by pressing ‘p’ on the keyboard in the editor Navmesh Content Examples | Unreal Engine Documentation ? (so you should see a green area where the navmesh is, make sure you have a navmesh where you want your AI to move)
In BTT_FindRandomPatrol you have set the input for PatrolLocation to SelfActor, did you meant to use PatrolLocation like in the MoveTo task? And could you show the code of BTT_FindRandomPatrol?
Chrudimer - Thanks - your suggestion on changing the input from SelfActor to PatrolLocation solved that problem. Much appreciated!
I do have one more question - please let me know if I need to post it as a separate thread:
I’m still not seeing the ‘enemy’ turn towards me or move towards me when I cross its line of sight. I added a task when the enemy has a line of sight to print “Found you” on the screen when I’m first seen. It’s not even doing that. The first screenshot that I pasted below is the revised Behavior Tree. The second screenshot is the BTT_PrintString Blueprint.
Could you show the code where you set HasLineOfSight?
In “Rotate to face BB entry” and in “MoveTo” there should be something else than SelfActor. And in BTT_ShowMessage you need to call FinishExecute, otherwise the execution process won’t go further than that (a task blocks until you call FinishExecute inside it).
And when you call FinishExecute there, then Success should be true (otherwise the Sequence “ChasePlayer” will stop there, since Sequence executes their childrens from left to right until one of them fails, has Success false).
I’m having a similar but-not-quite-the-same problem that I think bears on this topic: my tree is active and working ok, but it looks like the HasLineOfSight variable isn’t getting updated. Here is the event graph for the AIController.
Note that the EnemyActor is returning “none” and the HasLineOfSight is returning “false.” (Top Right) I can’t figure out why so must be overlooking something.