The Power of Render Texture : Setting Up and Using
Mirrors, Security Monitors and Secondary POV Cameras all share on useful feature that can be found in Unity, Render Textures. Today we are going to look at how to setup and us them in your game. For this demo, we will be making a UI Secondary Camera View similar to a Security Monitor
To start, we will need to make a new Render Texture. Opening the context menu in your project, we find Render Texture about half way down the Create menu.
Once you’ve renamed your Render Texture, create a Material to apply your render Texture to objects in the Scene. As a Material, we will be able to use it on any surface in our game.
Since we are using it on the UI, we will simply use the Texture with the Raw Image from the UI Menu. If we wanted to place it in the world of the game, we would use a Quad 3d Object and the Material.
Next, We need to create a Camera, separate from the Main Camera, to use for the new view.
Then under Output in the Camera, find the Output Text. By default this will be empty. We want to place the Render Texture in this place. You should see a change in the Camera View in the Scene window.
The Camera’s settings will adjust to the proportions of the object or image that the render texture is attached to. And now you have a a view of the game that is not attached to the Player’s Main Camera.