Visual Scripting
The Unity Visual Scripting integration lets Start Script Graph raise a custom
event in a Script Graph and optionally wait for that graph to resume the
Behavior Tree.
Expose the integration nodes
- Install Unity’s Visual Scripting package.
- Import
VisualScripting.unitypackagefrom the Behavior Designer Integrations
folder or the Opsive downloads page. - In Project Settings > Visual Scripting, add
BehaviorDesignerExtensionsto Type Options. - Choose Regenerate Nodes.
Connect a Script Graph
- Add a Custom Event node to the Script Graph and give it a unique name.
- Add Start Script Graph to the Behavior Tree and enter the same event name.
- Enable waiting on the task when tree traversal must pause until the graph
finishes. - At the end of the Script Graph path, call Resume Behavior Tree from the
Behavior Designer extensions and return the intended status.
When waiting is disabled, the task does not require a resume node and the graph
runs independently.
Troubleshooting
- Behavior Designer nodes do not appear: add the extension type and
regenerate the Visual Scripting node library after the integration compiles. - The graph does not start: make the Custom Event and task event names match
exactly and confirm the graph is active on the target object. - The task remains Running: add Resume Behavior Tree to every graph exit
that should finish the task.