SteamrollerStudios
New member
We spawn Gameobjects with Behaviour Tree components linked to External behavior Trees using a pooling system. These objects are reused. On startup of an agent behavior tree, we immediately set the value. When this happens we receive a large spike. When the behavior trees are used a second time or any time after, the spike does not occur.
Sample of some our code:
agentBehaviorTree = GetComponent<BehaviorTree>();
agentBehaviorTree.EnableBehavior();
BehaviorManager.instance.RestartBehavior(agentBehaviorTree);
_agentbehaviorTree.SetVariableValue("Agent", this);
When we set the agentBehaviorTree, we also set the variable value in that behavior tree. This seems to be an expensive task that is triggering the spike. The below shows the stats with spawning only one 1 enemy.
Sample of some our code:
agentBehaviorTree = GetComponent<BehaviorTree>();
agentBehaviorTree.EnableBehavior();
BehaviorManager.instance.RestartBehavior(agentBehaviorTree);
_agentbehaviorTree.SetVariableValue("Agent", this);
When we set the agentBehaviorTree, we also set the variable value in that behavior tree. This seems to be an expensive task that is triggering the spike. The below shows the stats with spawning only one 1 enemy.