I’m adding a behaviour tree owner and blackboard to an object at runtime, injecting a behaviour tree, and I think the best way to setup my blackboard is to do it in code since I can’t do it on an object then save it as a prefab right?
After this though, it appears the way to actually bind it to _navMeshAgent.destination so it gets updated during runtime is to use the BindProperty function? But I am unable to figure out how to use it. A one line example even would help me figure it out.
I’m wondering if this is even the appropriate way to approach this problem of instantiating gameobjects and adding components at runtime, and thus needing to link all of those components/values at runtime without my behaviour tree graph turning into a cascading “GetComponent” chain.
Variables required include: Current position of the object it’s on, the navmesh destination, target position, anything related to AI.
Be sure to use the correct variable type that matches your binding target. If you’re building to AoT platforms be sure that the parts you’re referencing here indirectly won’t get stripped from the build.
Also from what I know, you could just setup the bindings on a prefab then delete the binding target components from it, but you’ll have to notify the blackboard of the “binding context” at runtime in some cases (see IBlackboard.propertiesBindTarget to find out more about that) and re-bind the variables if you have to change it.