Instances lose their trees?

thretch

Member
When I try to create multiple instance of my game object (one behavior tree on the prefab), the instance's behavior tree is empty, and I get:

The behavior "Behavior" on GameObject "Enemy 1" contains no root task. This behavior will be disabled.
UnityEngine.Debug:LogError(Object)
BehaviorDesigner.Runtime.BehaviorManager:LoadBehaviorComplete(Behavior, BehaviorTree)
BehaviorDesigner.Runtime.BehaviorManager:EnableBehavior(Behavior)
BehaviorDesigner.Runtime.Behavior:EnableBehavior()
BehaviorDesigner.Runtime.Behavior:Start()

Here's the instance code:

for (int i = 1; i <= numInst; i++)
{
GameObject thisInst;
thisInst = Instantiate(enemy, transform.position, transform.rotation, transform);
thisInst.name = "Enemy" + i;

behaviorTree = thisInst.GetComponent<BehaviorTree>();

var isLeader = (SharedBool)behaviorTree.GetVariable("isLeader");

// set the first one as the leader
if (i == 1)
{
isLeader .Value = true;
} else
{
isLeader .Value = false;
}
}
 
Top