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 arena camera in your game:
Create a new Render Texture asset using Assets >Create >Render Texture.
Create a new Camera using GameObject > 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 of the new Camera.
Create a new 3D cube using GameObject > 3D Object > Cube.
Drag the Render Texture onto the cube to create a Material that uses the render texture.
Enter Play Mode, and observe that the cube’s texture is updated in real-time based on the new Camera’s output.