What kind of method should I use to track all of the ships in my scene?

I’m not sure how to concisely phrase this but what I can definitely describe it.

I have an objectpooler class which works.

I’ve used it to manage bullets and things but what I’m interested in is having an efficiently searchable reference object for my spaceships when they are not in the pool. The searching is important because it should allow me to find ships in the scene quickly.

Not sure if its the best way to do this but I was thinking of pulling ships from the pool when they are needed. Plus when a reference to them is also needed for things like target tracking or getting blown up by the player, I need to be able to quickly get a reference to them. So my method was going to consist of: when a new ship needs to be spawned, get it from my objectpool and put the gotten ship in to some kind of data structure. When that ship is damaged or destroyed I can update its state by finding it in that data structure. When destroyed it will be removed from the data structure and put back in to the object pool.

Does anyone have any thoughts? I may have to review my data structures materials… possibly implement something myself.

Using System.Linq allows you to quickly find objects from a List based on a criteria (ie:Active State).
I usually keep all objects of a pool in a static List. It’s easy to find the next available (inactive) one, then whenever you want to Destroy it, you simply set it inactive again.