- Home /
Character Controller's performance for massive groups
As generally advised, I have built enemies in my game using the character controller.
I have then tried spawning lots of them (probably hundreds) and the game got slow, mostly because of the controller script itself, and Physics.Simulate (which I assume is the physics engine process).
So I kind of expected that, but I am wondering: How should one go about having very large group of enemies, performance-wise?
In my case, my script was eating 66% of the time (which may be because of poor prototyping code so don't mind that) and physics 33%. Which means only the fact of the character controller existing already takes a third of the power (in my case, at least).
Are there ways to optimize the character controller? Or other alternatives for large groups? I should precise, I still want my enemies to have their AI, I'm just looking for ways to optimize them.
PS: The floor in my game isn't flat, so I need some sort of collision detection for them to keep moving on the floor
Your answer
![](https://koobas.hobune.stream/wayback/20220613144643im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Add 2d rigidbodies to moving objects to increase performance or not? 1 Answer
Mobile physics optimizations and Mesh Colliders 1 Answer
Physics calculates collisions between disabled layers 0 Answers
Improve Physics Performance For large Number of Objects 1 Answer
Understanding Raycast How Actually works in Unity [As Algorithm] 2 Answers