If you count unity's instantiate function as a bullet spawning method then yes (hopefully the performance isn't brutalized too hard lol)
Viewing post in Anyone using their own bullet spawning system?
so there are a few levels of performance, it depends on your target hardware and how many bullets you want to spawn!
The worst is using Instantiate, where every bullet has a script and a rigidbody.
The easiest optimisation is to ditch Instantiate and use a pooling system - I highly recommend LeanPool, it's so easy to use!
For another performance boost, get rid of the monobehaviour on every bullet, and have one Bullet Manager class that moves all the bullets.
Then, remove the rigidbody and collider on the bullet, and use Physics2D.OverlapCircle (or OverlapCapsule if you want continuous collision detection lite 😂) in the bullet manager in fixed update.
Then swap out OverlapCircle for OverlapCircleNonAlloc.
Then ditch the Gameobjects entirely, and use Graphics.DrawMesh to render your bullets.
Then ditch unity physics and write your own using jobs and burst. This is where my asset stops - it'll do 10,000 bullets on screen at a solid 60fps on my MacBook!
Then ditch all of that and do it all in a compute shader 😂
Remember to always filter your collisions! One of the best ways to optimise is to just do fewer things - bullets *do not* need to collide with each other, you can use Unity's layers and collision matric for that. Oh and circle/sphere colliders are computationally the cheapest. Use them wherever possible 😁
it is free during the jam! Only restriction is that it will stop your project from building once the jam has finished ☺️
You don't need to do all of them. The last three are hugely overkill - that's for console games or maybe low end android phones 😂 you'll probably do fine just pooling them and using a bullet manager instead of a bullet script on every bullet!
Yeah i saw that, the stopping the project building after is the thing that stopped me from using it as i didnt want to leanr how to use BulletFury then have to replace it all and learn pooling too to get it to work after. Just easier for me to dive into the deep end instead :)
Yeah ill probably stick to the pooling, the manager and the collisions being reduced and see how that goes :)
yep so the bullet manager is just *one* script on the object that's doing the shooting. Having a bullet script on every bullet is the thing we're trying to avoid with this ☺️
LeanPool is an asset from the asset store, it's free! You just replace Instantiate with LeanPool.Spawn, everything else is the same. Almost makes you wonder why unity doesn't have something this simple - unity itself has pooling built in, but it's way more complicated! https://assetstore.unity.com/packages/tools/utilities/lean-pool-35666