Rendering only when player is nearby.

I am trying to make a script that only renders a particle system when the players view can see it. My game is basically a 2d space sandbox game and having too many star particles causes it too lag out. If anyone can help my with some sort of script to make an endless star particle that doesn’t lag i will be grateful.

Use the built in particle system framework. I made mine a child of the camera, gave the particles a long life, a velocity of 0, and simulated in world space.

You dont want to do this via scripts and gameobjects.