Generate 2d star background
I am trying to make a top down 2d space game and 1 thing I would like is a star filled background. The world will be quite big and I need an efficient way to generate stars upon loading the game. I've tried using the awake() function with a for loop with star gameObjects but that either takes to long, or outright won't load if the scale in big enough. Iv'e tried generating some in an area around the player and the rest in the background using Update() but that caused extreme amounts of lag. My next idea is to make it so that the stars generate in "chunks" when the player gets close enough and destroy them when the player in far enough away. I just don't know how to do that. Any help would be appreciated. Thank you.
Your answer
Follow this Question
Related Questions
Weird infinite loop-or just long loading time 2 Answers
2D Top Down Combat: How to only damage enemy that the player is facing? Up,down,left,right 1 Answer
Top-down Room based dungeon: darken the rooms the player isn't in 0 Answers
Best way to generate meshes based on algebraic functions? 0 Answers
Background in 2D game: sprite or image? 0 Answers