Closed Chris1234567899 closed 2 years ago
Well you usually want spliced trees to be self sufficient with dynamic conditions. I don't store memory references to the nodes as that could be a lot of memory overhead for a project.
I wouldn't try to "edit" trees directly after building, a lot of caching happens under the hood. I think you have these options below to solve your problem. I'll list them in order of how highly I'd recommend them.
PS For faster feedback we have a Discord to quickly answer questions
Thank you very much for the quick answer. I guess I'll give the first one a try.
I've seen there is the option to inject a tree in the build process (example in the readme). However, the Splice method also seems to allow injecting a tree during runtime into an existing one.
public void Splice(ITaskParent parent, BehaviorTree tree);
However, how can I get the correct parent node from my existing tree? Is this feasible? Would be nice to have something like "BehaviorTree.GetNodeById(string id)" or alike.
Example use case: I plan to have a behavior tree for units like
My units will be assigned to different jobs during their lives (or no job at all) so at the "work" node I'd like to inject/replace a tree "woodcutterbehavior" or "farmerbehavior" or alike. At runtime, obviously.
Sorry if this is kind of a noob question, I'm only just getting familiar with Behavior Trees.