Debugging poor performance on this tree

CToia

New member
I have created a behavior tree for an AI that is in Search mode by default unless it sees an enemy, then it pursues it and searches its last known position if it loses sight of it.

I am getting a lot of lag, so something (or multiple things) in my design are probably being called every frame and causing the lag. Can someone please look at my tree below and let me know where it might be occurring? Happy to hear any feedback on my tree so far. Also, is there a performance analyzer or something that people usually use to help narrow down where the issue is occuring?

I'm still new to Behavior Designer but loving the transition from my FSM.

Snipping.PNG
 
Does BD call a tick each frame? I found that usually it works fine with up to 0.5-1 sec ticks without it damaging the gameplay to much.

Check the behavior manager for tick rate.
 
Great, thanks for your suggestion @Grannyboy. This has solved my issue for now. If my behavior tree is shoddily setup then I'm sure I will run into issues again in the future but it is smooth again for now.
 
I recommend using the Unity profiler as it will show you exactly where the bottleneck is. It may not be within the behavior tree itself and something that you didn't expect.
 
Yep you're right, the profiler showed it was a GPU issue. I didn't realise I had stable diffusion on in the background but this pointed me to the right direction. I put my tree tick rate back to each frame as my AI works a lot better there.
 
Top