Hey, I am currently working on a project and I have a mechanic which requires me to spawn a lot of object at once (360 to be exact).
I have recreated the mechanic and it's setup in a blank project, so you can see for yourselves, but here is a screen shot of the logic as well.
Have you tried pooling this objects and use them from the pool?
On start of layout create an amount of objects outside the layout and use them instead of spawn them. And when possible, reuse it, set it to invisible or move it outside of the layout and keep using them instead of spawn it.
Develop games in your browser. Powerful, performant & highly capable.
It might be worth giving a try, though having 360 objects for each character always being alive will probably start stacking up as well. Thanks for the reply.
A quick profile shows the biggest performance impact is that it's absolutely hammering collision detection. Turning off bullet stepping and "bounce off solids" and relying on a single "is overlapping" event is far faster, at the expense of slightly reduced precision at the point of impact.
The bullets have to test collisions constantly as they move, though. Probably a much faster approach would be to use raycasting to immediately identify all the points of contact with the scenery upon creation, and then just tween the bullets towards the destination with no collisions enabled.
Awesome! I totally didn't think of that, I'll give your Tween solution a try. Always appreciate the help Ashley!
I ended up going with your raycast approach, but used the MoveTo instead of Tween behaviour to move the "bullets". It worked a treat, thank you for the help.