Sharon Giselle
Sharon Giselle

Reputation: 121

How can i make the second camera to display in the bottom right corner in a small window only specific gameobject?

I added a new layer called it: CameraLayer.

I have one Camera as child under the first ThirdPersonController tagged as MainCamera. I set that this camera will show everything but the CameraLayer. In the inspector in Culling Mask. Everything marked but not the CameraLayer. And now i see in the Culling Mask: Mixed. This is the main camera showing everything.

The second camera i added as child under a Cube. And i want that this camera will show only the cube all the time in a small window in the bottom right corner in the Game View window while the game is running. In this camera Culling Mask i selected only the CameraLayer and unselected the rest. So in this camera in the Culling Mask i see: CameraLayer.

But when i'm running the game i don't see the Camera under the Cube at all.

In the screenshot i marked in black where should the Camera under the Cube should be and display the Cube:

Camera

Upvotes: 2

Views: 5402

Answers (1)

Ludovic Feltz
Ludovic Feltz

Reputation: 11916

1) Create a Canvas as child of your first Camera then create a RawImage as a child of this newly created Canvas.

This is this Image that will render your second camera video so move it at the bottom right of the view of your first camera.

2) Then Create a RenderTexture and assign it to the Texture property of the RawImage you just created

3) And finally assign this RenderTexture to the Target Texture property of your second Camera.

This Target Texture will be used by Unity as a buffer Texture for your Camera. Your scene should now look like this:

enter image description here

Upvotes: 13

Related Questions