How can I go about creating an "Infinate" asteroid field??


Ok so what i have, is a top down game, with a little ship you can fly around.

What I want, is to be able to fly for any distance in any direction, and still run into asteroids.
Obviously I cant instantiate hundreds of asteroids and never delete them - so what Im after is any advice or techniques I could use to create this effect?
What I had thought might work is something like a spawner/catcher system, that is parented to the ship.
So it spawns asteroids off screen, around the player, and then when you move past them, the catcher deletes them, off screen aswell…
Im not sure if this is a convoluted idea though - perhaps there is a better way?

Thanks in advance!

What you require is an object pooling system. Basically you will only instantiate the desired amount of objects in the start of the scene and put them in a container (array, generic list etc.)

Then you have to enable and position those objects (only use the non active ones) based on the player’s velocity (where the player is heading) just outside the viewport. And also disable the ones which leave the viewport and not in the direction the player is heading.

Do a google search for Unity3d object pooling. Here is an official tutorial Unity Connect