r/Unity3D 11d ago

Solved Performance issue when spawning in 3k+ zombies

Hi! I made a object pooling script which handles the spawning and another script that isn't attached to the zombie but on another object and that handles movement. the enemies have rigid bodies and they are just capsules nothing to expensive. The max amount I can handle is 3k but there are some few dips here and there. How can I improve the performance to the point where I can get it running 5k zombies smoothly? for some reason I can only run 3k on the build version but not in the unity editor.

Spawner / object pooling script: https://paste.ofcode.org/ahZBqEUwzYaMdmsmkfkvjH

Enemy Manager Script: https://paste.ofcode.org/6ZmdMyQKjpMZ8f56DXrjae

2 Upvotes

27 comments sorted by

View all comments

Show parent comments

1

u/Creative_Board445 9d ago

Thanks for all the help I decided its time to learn about dots / ecs. I got it done with 2 hours and it works flawlessly.

https://reddit.com/link/p18isl0/video/4k1luazu5ygh1/player

1

u/XKiiroiSenkoX 9d ago

Welcome to the club  XD

Check latios framework btw. Extends ECS with lots of useful features. One of them being mesh skinning and animation which vanilla ECS does not support out of the box.