if 10 same AI characters use an external behavior in the scene, can it improve performance?

(1) if 10 same AI characters use an external behavior in the scene, can it improve performance?



(2) will JSON or binary affect performance?



(3) I make character controller into a prefab, and then the inspector panel of this prefab will be very slow in hierarchy. What should I do? Non prefab has no such problem.



thanks very much.
 
1. No - in that case there still needs to be 10 instances of the behavior tree.
2. Binary is faster than JSON, but once the tree is loaded it doesn't affect performance.
3. Have you tried profiling to see what is causing the bottleneck?
 
3. Have you tried profiling to see what is causing the bottleneck?
I didn't use profiler because it happened in edit mode. When I operate the inspector of this prefab in edit mode, it will be very slow. For example, clicking the enable button of one component is also slow. But non prefab is normal in edit mode.
 

Attachments

  • prefab_component.png
    prefab_component.png
    25.9 KB · Views: 6
Because I'm manually assembled in hierarchy, it's easy to control attributes by making multiple identical AI characters. Please see the screenshot. The sub objects and sub prefab I added below are in root prefab, which I did not include. The inspector panel of this root prefab is slow.

I tested the result (1) if it is a single root prefab, and there are no sub objects and sub prefab, then it will not slow down, which is normal.

Results (2) after manual configuration, drag them to a whole prefab, then it will not slow down, which is normal. However, if the component properties of the sub prefab are modified internally, it will be very slow to load when auto save is opened, because it affects a lot of AI prefab instances, and it will be slow to save manually, so I did not use a lot of different AI prefab, and the saving will be slow after modifying the sub prefab.Hold on... For a long time.
 

Attachments

  • 20191125_1.png
    20191125_1.png
    4.5 KB · Views: 4
  • 20191125_2.png
    20191125_2.png
    26.5 KB · Views: 7
I didn't use profiler because it happened in edit mode. When I operate the inspector of this prefab in edit mode, it will be very slow. For example, clicking the enable button of one component is also slow. But non prefab is normal in edit mode.
The profiler can still work in edit mode. At the top there is a "Profile Editor" button which will allow you to profile the editor. I haven't noticed a slowdown with just the behavior tree component so this will take some debugging.
 
The profiler can still work in edit mode. At the top there is a "Profile Editor" button which will allow you to profile the editor. I haven't noticed a slowdown with just the behavior tree component so this will take some debugging.
OK,I tested the result in profile editor. the first picture is normal. The second picture is that I am clicking this prefab in hierarchy.
 

Attachments

  • normal.png
    normal.png
    93 KB · Views: 9
  • selecting prefab in hierarchy.png
    selecting prefab in hierarchy.png
    94.8 KB · Views: 9
Last edited:
Another test result: When I run play, I also tested that clicking on prefab is normal in hierarchy, and inspector panel of prefab will not slow down.
 
Thanks - unfortunately Behavior Designer isn't in that callstack at all so I'm not able to fix it. If you submit a bug report to Unity they should be able to take a look at it.
 
Top