• Opsive has been nominated for TWO Unity Awards: Publisher of the Year and Best Development Tool (Behavior Designer Pro)! Your support means everything, cast your vote here: https://awards.unity.com/vote

Is there a way to "Print out" the behavior tree?

jfcarter

New member
Hi,
I'm wondering if there's a way to get a "printout" of a behavior tree's structure. Ideally something like a simple text hierarchy that lists the names of each task and their parent-child relationships.

For example, something like:

Root (Sequence)
├── CheckHealth (> 20%)
├── Parallel
│ ├── Attack
│ └── LookAt

I'm currently writing these by hand to use in documentation and for discussions (e.g. sharing structure with ChatGPT for AI planning help), but it's getting a bit tedious. Is there any built-in feature, debug tool, or third-party utility that can export a tree's structure like this? Or would I need to script something custom?


Thanks in advance!
 
There isn't a built in way but it would be fairly easy to script something like that using an editor script. You'll want to get the tasks from the behavior tree component and then traverse the task. I recommend looking at the FindTask method within the component for an example of traversing the tree.
 
Back
Top