Big spike when I enable behavior trees

Sylmerria

New member
Hi !

I have big hit performances in my game when I enable behavior trees.
Like show the image below, 6 behavior trees take 13ms to initialize.

p1.PNG

my code to start this behavior trees is :

C#:
Profiler.BeginSample("[AgentTracer][Activate] Init BT");
_behaviorTree.SetVariableValue("Speed", _agentTracer.Speed);
_behaviorTree.EnableBehavior();
Profiler.EndSample();

And the behavior tree model

Agent BehaviourScreenshot.png

How can I reduce this because I will have many more BT in the future :(

Thanks :)
 
Top