In this lesson, you will learn how to use the Visual Logger and the Behavior Tree Debugger to identify why your AI is failing to make decisions or executing the wrong branch of your logic.
When your AI stops behaving as expected, staring at your Behavior Tree isn't enough because you cannot see the internal state changes in real-time. To fix this, we use two critical diagnostic tools: the Behavior Tree Debugger and the Visual Logger.
Using the Behavior Tree Debugger
While playing in the Editor (PIE), press the apostrophe (') key to open the Behavior Tree debugger. This overlay is your window into the AI's "thought process."
- Node Color-Coding: Active nodes are highlighted in green, while failed nodes turn red. If you see a
Selectornode stuck on a branch you expect to be skipped, check theDecoratoron that node. - Blackboard Monitoring: On the right side of the debugger, you can track the current values of your
Blackboard Keys. If your AI isn't moving, check if theTargetActorkey is null; if the logic fails to update that key, the tree will never transition to the movement task.
Leveraging the Visual Logger
If the logic involves movement or perception errors, the Visual Logger (Window > Developer Tools > Visual Logger) provides a historical record.
- Record a session by clicking the Red Dot in the logger.
- After the AI fails, stop recording and look at the timeline.
- Select your AI agent. You will see a log of every
Service,Task, andDecoratorthat fired.
For example, if your Decorator logic is failing to trigger an abort, the Visual Logger will show you the exact moment the Blackboard Key changed and whether or not the conditional check passed or failed at that timestamp. If a Service is supposed to update a key but isn't, the logs will show it failing to run or returning a null result, allowing you to narrow down your fix to the specific Blueprint node.
Key Takeaway: The Behavior Tree Debugger shows you where the AI is right now, while the Visual Logger shows you the history of why it got there.