Currently I am having a huge frame drop when I get about 300-400 units, What is the best practice to maintain a large amount of units (possibly 5000 and up is my target) in a simple top down RTS, according to the profiler the the biggest chunk of spent memory is in Physics2D.FixedUpdate and Unit.FixedUpdate
My units all have a RigidBody2D as well a circleCollider2D to handle collisions as well as not have them clump in together. but whenever I move them (the code inside FixedUpdate) my framerate goes to hell, any tips?
My game does have alot of times when units will be clumped together while moving through small choke points.
The following is what I assume is the main culprit, either the way I move the units, or the physics controlling them, the profiler states 60% towards unit.fixedupdate and 35% for physics2d.fixedupdate
void FixedUpdate ()
{
if (Moving) {
tForm.position = Vector3.MoveTowards (tForm.position, PointB, this.Velocity * Time.deltaTime);
}
}