External behaviors: How to set up and start them?

brl0000

New member
I've got a behavior tree adapted from the UCC integration example that I wish to use as an external behavior on multiple agents. I've successfully exported it. When I can get it to actually execute, it works as I need. But it seems to only want to run in the editor, and only if I have the agent selected when I enter play mode. I'm not sure why this should ever require the item to be selected in the editor to execute, but that's what it does. So something is wrong.

Per the docs, the field in the Behavior Tree class labeled "External Behavior" claims to reference a behavior that executes when the behavior tree class starts. In the documentation for the external behavior itself, it says that external behaviors are invoked by using a Behavior Tree Reference task node (within a parent graph). This is confusing. Which method should I use?

Any help or links to tutorials would be appreciated. Thanks!
 
Last edited:

Justin

Administrator
Staff member
External behavior trees can be set two different ways:

1. On the behavior tree component itself
2. Referenced from the Behavior Tree Reference task.

These trees will load regardless of if you have the editor open or not. As a simple example you can take a look at the RTS sample project which uses the second method.
 

brl0000

New member
Thanks Justin! I'll take a look at the RTS sample project.

As an aside, I can confirm that the behaviors do run in the build as opposed to just in editor play mode, but they don't function the same. The agent will react to damage and try to melee when the player is within range, but the agent won't pursue the player or seek waypoints like it does in editor play mode. I would guess this has something to do with variables' values being lost somehow, or changed from how I set them in the inspector.
 
Top