I’ve created a very simple terrain and instatiate capsules. When the game starts my fps is around 400 but after 20 or more capsules are instatiated, the framerate drops below 3!
I’ve tried to disable all scripts except the one which performs the controller.SimpleMove
When I disable the move, the fps is just fine (over 300). How can I fix this? I’m sure Unity can perform a lot better than this.
The A-star path-finding takes a while to run. You want to call StartPath as little as possible. If you can, just call it once when you spawn each capsule. Make sure nothing is auto reComputing paths (one of the tools will compute a new path every so often. I can’t tell if you are using that one.)
Also, fewer nodes in the path grid will run faster. Try making the squares larger, so you doon’t need as many. Or, can hand-make a “List Graph” for AstarPath, using a lot fewer points, and switch from the grid to that.
Or, if you know the paths in advance, just make it and skip pathFinding altogether.
I found another way of doing this, probably the right way. Instead of using the SimpleMove method, I’m now usting the Translate method of the capsule’s tranform: