A lot of objects in 1 scene

I’m making a top down space game, and I’ve made a script that will generate stars in a specific area. Now if I pick a really big area, say from x-1000 to x1000 and y-1000 to y1000, and generate a lot of stars in there. The game starts lagging, because I have all the stars bound to an empty object, and the empty object has a script attached to it. Which will make the stars stay in the background and move slower according to the movement of the ship. Now my question is, is there any way to make it so that the game doesn’t lag when there are a lot of moving objects involved?

Creating individual gameobjects for something as prolific as stars is not a good idea.

Why don’t you just make a few textures and layer them at different depths so they move at various rates relative to the ship? This is much more standard, reduces load and is easier to do.