Hiding everything outside a certain point?

Hi I’m making a game where the player can move around within a certain radius of the center of the scene. The game is 3d but gameplay is in 2d plane.

When the player gets to the edge of the radius I would like to be able to (for starters) just draw a black cover outside the radius like the image shows.
I’m guessing this can be done with some screen texture overlay? But I’m not sure where to start. If the solution supports adding additional textures besides just black, then that would be great.

Any help appreciated! (My first question!)
Thanks!

94626-unityquestionimage.png

If it’s a large scene you may want to use a special shader that does a distance check inside the fragment shader. You would simply draw a fullscreen rect with that shader and pass the current center of the world to the shader. That way the shader can calculate the distance of each fragment from the origin and can fade-in the “outside” color. That color can be based on a texture.

That shader could be used by a postprocessing script.

Yeah this can easily be done with a texture overlay.

Literally just assign an alpha texture ‘Circle’ to your material, apply it to a quad or a plane and child it to your player game object. Anything inside the circle (Alpha) bit can be seen, anything outside (Non alpha) will be covered by the black. You can either swap out textures or have a white texture and use:

gameObject.GetComponent<Renderer> ().material.color = Color.green;

To drive the color of the material texture.