Overview | Key Features | Videos | Documentation | Samples | Add Ons | Support

Doc Home > Debugging

When a behavior tree is running you will see different tasks change colors between gray and green. When the task is green that means it is currently executing. When the task is gray it is not executing. After the task has executed it will have a check or x on the bottom right corner. If the task returned success then a check will be displayed. If it returned failure then an x will be displayed. While tasks are executing you can still change the values within the inspector and that change will be reflected in game.

Right clicking on a task will bring up a menu which allows you to set a breakpoint. If a breakpoint is set on a particular task then Behavior Designer will pause Unity whenever that task is activated. This is useful if you want to see when a particular task is executed.

When a task is selected you have the option of watching a variable within the graph by clicking on the magnifying glass to the left of the variable name. Watched variables are a good way to see the value of a particular variable without having to have the task inspector open. In the example above the variables "Fleed Distance" and "Flee From Transform" are being watched and appear to the right of the Flee task.

Sometimes you only want to focus on a certain set of tasks and prevent the rest from running. This is possible by disabling a set of tasks. Tasks can be disabled by hovering over the task and selecting the orange X on the top left of the task. Disabled tasks will not run and return success immediately. Disabled tasks appear in a darker color than the enabled tasks within the graph.

One more debugging option is to output to the console any time a task changes state. If “Log Task Changes” is enabled then you’ll see output to the log similar to the following:

GameObject - Behavior: Push task Sequence (index 0) at stack index 0
GameObject - Behavior: Push task Wait (index 1) at stack index 0
GameObject - Behavior: Pop task Wait (index 1) at stack index 0 with status Success
GameObject - Behavior: Push task Wait (index 2) at stack index 0
GameObject - Behavior: Pop task Wait (index 2) at stack index 0 with status Success
GameObject - Behavior: Pop task Sequence (index 0) at stack index 0 with status Success
Disabling GameObject – Behavior

These messages can be broken up into the following pieces:

{game object name } – {behavior name}: {task change} {task type} (index {task index}) at stack index {stack index} {optional status}

{game object name} is the name of the game object that the behavior tree is attached to. {behavior name} is the name of the behavior tree. {task change} indicates the new status of the task. For example, a task will be pushed onto the stack when it starts executing and it will be popped when it is done executing . {task type} is the class type of the task. {task index} is the index of the task in a depth first search. {stack index} is the index of the stack that the task is being pushed to. If you have a parallel node then you’ll be using multiple stacks. {optional status} is any extra status for that particular change. The pop task will output the task status.


<- Writing a New Action Task
Variables ->