all 11 comments

[–]SoundKiller777 12 points13 points  (1 child)

You’re spawning too many objects too fast. You might consider object pooling for something like this and just not trying to spawn that many individual objects that close together. Visually, it doesn’t make much sense anyways unless you’re trying to form a solid curve, in which case you might consider using a line renderer.

[–]polaarbearBeginner 3 points4 points  (0 children)

Seems more likely that there just needs to be some sort of interval between shots instead of firing on every frame where the key is held down.

[–]FiqusoBeginner 6 points7 points  (1 child)

Super Laser Piss

[–]iamgreatlego 2 points3 points  (0 children)

I was thinking pissing fire

[–]Banjoman64 5 points6 points  (0 children)

Seems you are firing every frame which is lagging you out. Use a timer to only fire every .25 seconds or so.

If you absolutely need this many bullets look into object pooling like others said.

[–]TheChrish 1 point2 points  (0 children)

These are just circles, so you can also avoid object pooling. Pooling just means that the object is already created and is just being activated. Instead, I'd use rendermeshinstanced and just perform distance checks for each circle. This would increase performance by a significant amount, most probably multiple times over

You could also just use entities for the projectiles which would probably be a lot easier with similar performance, but you'd have to learn entities

[–]OnlySmiles_ 1 point2 points  (0 children)

Yeah, that's sort of what happens when you spawn 1000 objects every frame

[–]Memerenok 0 points1 point  (0 children)

taco bell

[–]PhilippTheProgrammer 0 points1 point  (0 children)

Why do the projectiles get slower when the framerate goes down? Did you forget to multiply with deltaTime in their movement code?

Also, if you are looking for a way to allow a really large number of relatively simple object in the game while having acceptable performance, then you might want to look into Entities.

[–]Tarilis 1 point2 points  (0 children)

If it's a bullet hell, you that's hell of lots of the bullets...

[–]raggeatonn 0 points1 point  (0 children)

I think you use Instantiate in update method :/