Hello, I am new to Behaviour Designer and have been looking how to implement the formation pack into an RTS environment. I'm trying to set it up in a way that the first unit selected is the designated leader, while also setting this unit as the leader for the followers. So far, I have managed to get this set up in a way that allows me to get and set the leader for all of the following units; but no matter what I seem to do, it always ends with a sack overflow involving the "AddAgentToGroup" function. I have tried breaking everything down into separate pieces to try and single out what is causing the issue, but I can't seem to find any solution.
At the moment, I have the tree set up like the attached picture in my attempts to break down the process. The tree on the left is the one used by the leader unit, and has no gameobject set as the leader. The right tree is used by the followers, and uses a sharedgameobject variable for the leader, which is set as the unit running the left tree. I did a bunch of digging into this issue and I thought it might have been caused by the leader trying to insert itself into the agent group infinitely, but I don't see how that could be happening. Before the right tree moves to the swarm task, the task before it works like:
BT = manager.GetComponent<BehaviorTree>();
BT.SetVariableValue("Leader", leader);
And it does set the correct value for the variable in the end, and it only runs once before the swarm task is activated. I'm just absolutely stumped on this issue and I would love some help figuring this out, please and thank you!
At the moment, I have the tree set up like the attached picture in my attempts to break down the process. The tree on the left is the one used by the leader unit, and has no gameobject set as the leader. The right tree is used by the followers, and uses a sharedgameobject variable for the leader, which is set as the unit running the left tree. I did a bunch of digging into this issue and I thought it might have been caused by the leader trying to insert itself into the agent group infinitely, but I don't see how that could be happening. Before the right tree moves to the swarm task, the task before it works like:
BT = manager.GetComponent<BehaviorTree>();
BT.SetVariableValue("Leader", leader);
And it does set the correct value for the variable in the end, and it only runs once before the swarm task is activated. I'm just absolutely stumped on this issue and I would love some help figuring this out, please and thank you!