I am developing a strategy game that has many units that must be able to attack each other. Each unit has a rigidbody (kinematic) and sphere collider (trigger) attached. This sphere collider allows them to “see” enemies, which will make them chase said enemy. The units work in such a fashion due to the mechanics of the game.
At any one time the amount of units will grow to a few hundred (let’s say 400-500 max). This slows down mobile devices a lot, so I decided to use layers so that units don’t “see” (or do collisions) against their friends. Also, I disable the trigger colliders when units are occupied with a certain task. I realize that several hundred units may seem strange to some. Keep in mind that each unit is essentially expendable and quite simple. Still, I have to give of them some sort of behavior.
Anyway, it is still difficult to optimize my game for iOS despite my efforts. The game becomes even slower when units actually move with the triggers enabled. I was wondering if anyone had ideas to share in regards to optimizing physics to physics-heavy games, which would go beyond ignoring collisions using layers? i.e. are the sizes of the game objects important as well? This would relate to whatever acceleration structure that Unity uses for physics. Thanks…