[Solved] Massive 264ms spike when using Behavior Design.

tatoforever

New member
1045

We are using External Behavior Trees with our AI Pooling System. We only use one BT for all our AIs and we warmup the pooled AI instances and all it's components but this spike happens every time we start using any of the AI instances with its attached External Behavior Trees when we call Behavior.EnableBehavior();
The BT we use is composed of few nodes that only plays animations (Animation system) for now and we are doing the pooling sugestion described in the documentation (external-behavior-trees).
Any way of avoiding this massive spike?
 

Justin

Administrator
Staff member
That looks like something caused by one of the tasks that you are using on the Unity side of things. Behavior Designer doesn't call any animation methods during initialization unless you are using one of the tasks that use that API.
 

tatoforever

New member
Yeah, it looks like Unity is doing some sort of initialization/warmup of animations clips/states. Cause the BehaviorTree is instantiated and initialized when the scene loads. The spike happens as soon as I play the very first animation of the AI (when the BehaviorTree gets enabled) but is not caused by BD.
I will look for a way to trigger this Animation warmup when the scene starts.
Btw, I looked at your source code and is cleanly well written. I was able to hook all your task nodes into our game events in less than a day. The data driven nature of it, make it extremely fast to execute on multiple instances (I have a lot).
Thanks for the quick reply.
 
Last edited:
Top