Drawing to textures with shaders via Custom Render Textures
Render a camera view to a Render Texture
A Render Texture is a type of TextureAn image used when rendering a GameObject, Sprite, or UI element. Textures are often applied to the surface of a mesh to give it visual detail. More info See in Glossary that Unity creates and updates at run time. To use a Render Texture, create a new Render Texture using Assets > Create > Render Texture and assign it to Target Texture in your CameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info See in Glossary component. Then you can use the Render Texture in a MaterialAn asset that defines how a surface should be rendered. More info See in Glossary just like a regular Texture.
To create a live sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info See in Glossary camera in your game, follow these steps:
To create a Render Texture, go to Assets > Create > Rendering > Render Texture.
Select GameObject > Camera to create a second camera.
Assign the Render TextureA special type of Texture that is created and updated at runtime. To use them, first create a new Render Texture and designate one of your Cameras to render into it. Then you can use the Render Texture in a Material just like a regular Texture. More info See in Glossary to the Target Texture property in the second camera’s InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info See in Glossary window.
Select GameObject > 3D Object > Quad to create a quad.
Drag the Render Texture onto the quadA primitive object that resembles a plane but its edges are only one unit long, it uses only 4 vertices, and the surface is oriented in the XY plane of the local coordinate space. More info See in Glossary. Unity automatically creates and assigns a material that uses the Render Texture.
Enter Play mode. The quad displays the camera view, which updates in real time.