How can I add a camera over a canvas ui? - unity3d

The main goal is to show a main menu with a preview window that show live camera for example the player camera.
I created a Render Texture named it MainMenuRenderTexture.
This screenshot show the Canvas settings :
This screenshot show the GUI Camera settings :
And rawimage I added over the Canvas.
I want to show on the rawimage another camera I have not the GUI Camera but another camera I have in the hierarchy.

Related

How to set Camera View a Specific Area in UI

My all project works in UI. One of my scene has videoPlayer and I would like to set my MainCamera to that specific Area. This scene is my Recording scene but for recording I have to use canvas Render Mode and has to be "Screen Space - Camera". How I can set my camera view to that specific area.
I tried 2nd camera with culling mask but didn't work because videoplayer is already my UI's child when camera Renders UI showing all children objects.
Is it possible show to camera whereever I want in UI?
enter image description here
Yessir it sure is. I literally had to do this a couple of days ago. Here is a tutorial/video I followed to figure out how to do it for my application. From the sounds of it, all you need to do is follow the video up to ~3 minutes. Then utilize the end product of getting a camera to showcase something in a UI window for your application.
For reference if the video gets deleted the process is as follows:
Create a new GameObject within the Canvas
Add a Raw Image as a child to to the new GameObject
We want a raw image because Raw Images in particular support the addition of a 2d Texture and this is what we need in order to display the Camera view.
Add a new Camera as a child to the GameObject
Create a new Render Texture in you Project Folder
Add the Render Texture to your Camera's Camera Component in the Target Texture field
Add the Render Texture to you Images Raw Image Component in the Texture field
Move the Camera to what you want to view and it should project to your UI GameObject.
If it doesn't do this correctly or the image has weird aspect ratios, check the dimensions in the Render Texture and your Image. It took me a while to get everything to look normal but it really just takes dimension adjustments.
Hope this helps!

How to add a Camera to a GameObject

I am new to Unity and am working on a UI project. I want to add a Camera targeted on a GameObject in the Canvas. There is a Camera with the same hierarchy of the Canvas and when I clicked it the preview is blank but when I play the project everything is shown, including all the buttons texts images.
How does the Camera work with UI and is it possible to add a camera targeted on a GameObject?
For your main Canvas, you do not need a Camera. Please see the Unity Manual for information regarding the Canvas. Take note of the Render Mode option on the Canvas Component. If this is set to Screen Space - Overlay then you will not need a camera to view UI Items or GameObjects that are placed as children to this GameObject. It will also inherently not appear in your Camera Preview if it is located under a Canvas of this type.
If you would like to have other GameObjects show up in the Camera Preview, add them to your scene and ensure that they are not under the Canvas GameObject. Then ensure that they are in range of your Camera.
Hope this helps!

Rendering video overlay with other unity cameras

I have a question about video overlay function of tango in unity.
I want to display video overlay image with NGUI elements.
When I turn on 'Enable video overlay' options in TangoApplication script, displays of other camera in unity scene are disappeared except UI created by Unity itself.(OnGUI and UGUI componets)
Is there a way to use other unity cameras with video overlay?
please, answer.
Thank you.

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:
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:

Unity canvas rect shows in game mode

After adding a GameObject -> UI -> button to my Unity canvas, when in game mode the canvas rectangle is showing up when I don't want to see it. It should only be visible in scene mode. How do I ensure that it is not visible in game mode?
Check if Gizmos is On. Turn it Off and outlining rectangle would not be visible in GameMode. Or it can be an Image component attached to canvas if you are talking about filled rectangle.
it turned out that when i built the game on android the canvas rect is not invisible (it is only visible in unity editor).