Object pooling or creating question?

Hey guys, I don’t know if I am making my life more easy or harder for no reason.
Currently I have created a system that handles a list of gameobjects as a pool, I am then thinking about pooling through the objects of the list to activate the next gameobject that is not active then moving it to the place I need it to, I am thinking of a dictonary to check bool, I won’t be checking if the gameobject is active.
But I am still looping through a list, and moving objects around, is that not overhead as well?
Should I just start spawning gameobjects at runtime? seeing how I activating and deactivating already a list?

I can’t see what’s makes it so much harder to use a pool. You don’t have to use a list of all GameObjects and iterate over it to find one being inactive. Instead you just remove the active objects from the list and only keep the rest. You can use the C# Stack class for that.

Further, instead of GameObject.Instantiate(…) you call var myObject = pool.Pop(). The positioning you mentioned has to be done anyways. If you’re done with the object you push it back to the pool.

I wrote a blog article about that topic. Maybe it’s helpful to you. Pooling Part 1: Optimize your game’s performance – Christian Henschel

Unity’s Tutorial for Object Pooling.