Using Object Pooling, assuming I'll like to spawn 500 cubes once every three seconds. How do I make it performance friendly? I need ideas, not the code itself.
in unity basically pooling means: instead of using
Instatntiate() that makes new object in the scene that takes cpu performance to allocate, make all of needed object on the start of the scene and only enable and disable them and only make new object when all of you instantiated objects are active and are not ready to reuse.
you can use a
for loop to look for in-active object to use it on a list but its not much performant. using a static array is much more performant than a list. as i searched on unity its best to use queue to make pooling. just en-queue an object that is ready to use and de-queue when it gets active.
just check this brackes link to check how its used: