Continuing on from this thread
My custom BehaviourTreeReference task returns whichever job is assigned to the worker at runtime, which changes throughout the game, this seems to be working correctly.
But, I can't figure out how to get the BehaviourTreeReference task to re-evaluate, it remains stuck with the first BT it returned when the scene/agent loaded the first time.
I've tried re-assigning the BT to the agent, disable/enable the BT, but no luck.
The only way I can get it to reload so far is to assign an entirely different ExternalBehaviourTree, then assign my common external tree back, that will then trigger the BT reference to load the right job tree.
I have a breakpoint in my custom class and it only ever gets hit once.
ExternalBehaviorTrees question
Similar to this thread: https://www.opsive.com/forum/index.php?threads/dynamic-instantiation-and-assignment-of-external-behavior-trees.9554/#post-46881 I have a handful of gameobjects the player controls very similar to a RTS/squad type game. It appears ExternalBehavior trees are the...
www.opsive.com
My custom BehaviourTreeReference task returns whichever job is assigned to the worker at runtime, which changes throughout the game, this seems to be working correctly.
But, I can't figure out how to get the BehaviourTreeReference task to re-evaluate, it remains stuck with the first BT it returned when the scene/agent loaded the first time.
I've tried re-assigning the BT to the agent, disable/enable the BT, but no luck.
The only way I can get it to reload so far is to assign an entirely different ExternalBehaviourTree, then assign my common external tree back, that will then trigger the BT reference to load the right job tree.
I have a breakpoint in my custom class and it only ever gets hit once.
C#:
public class LG_SetAiJobTree : BehaviorReference
{
public override ExternalBehavior[] GetExternalBehaviors()
{
List<ExternalBehavior> btList = new List<ExternalBehavior>();
btList.Add(LGAI_Manager.Instance.GetCurrentJobTree(this.gameObject.GetComponent<LGAI_Simple>()));
this.externalBehaviors = btList.ToArray();
return base.GetExternalBehaviors();
}
}
Last edited: