i forgot to select helpwanted tag, this is a helpwanted case.
I am recently working on a 2d Game which have massive enemies
(I always like to watch massive enemies coming, it give me chill)
however, when the enemies number get to too big like 100 or 200. The game starting to get very slow.
I am pretty sure this issue is due to all those collides from enemies to enemies pushing eachother. However, I don’t want to delete colliders because then enemies just collapse together like one enemy. it doesn’t looks right.
First, you should be sure that the collisions are the problem. Use the profiler and/or use a debug button
//pseudocode
void Update()
{
if(Input.GetKeyDown(Key.Space))
{
foreach(Collider2D c in FindObjectsOfType<Collider2D>())
{
c.enabled = !c.enabled;
}
}
}
What kind of collider do they have? You should use the simpler the better (circle or box). This could have a great performance impact.
But, If the massive number of enemies is going to be a key feature, you should take a look to ECS+Unity Physics.
The paradigm change could be quite challenging at the beginning, but this technology is totally oriented to address such a big number of entities. Enemies in your case.