One way to do this is exactly like you mentioned. The “roles” behaviour trees will only initialize once they are used by the “master” behaviour tree (so essentially when you change the blackboard variable holding the graph to a different graph).
The other way of doing what you are after, would be to actually add each “role” behaviour tree as a sub-tree into the “master” behaviour tree and use a “Switcher” node to switch between them (either by an integer or an enum variable on the blackboard). Even with this method, the sub-trees will not be initialized until and if they are actually used, unless the “Pre-Initialize SubGraphs” is checked in the BehaviourTreeOwner, in which case all sub-tree will indeed be pre initialized.
Let me know if that helps. Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
Login
Register
By registering on this website you agree to our Privacy Policy.