What means use camera.Render() to render the camera manually?

Well… I’m a newbie in Unity3D…
Recently I noticed the introduction of Camera.Render() in “Script API” of unity documentation mentioned that
“To make use of this feature, create a camera and disable it. Then call Render on it”.
I don’t know what this means, so I make a test. Just attach a script to the main camera.
The c# script attached to my main camera :
public class Test : MonoBehavior{
void Start(){
camera.enable = false;
}
void Update(){
camera.Render();
}
}

I think this could render something, but nothing appear except for black, and the blue background is also disappear. So I guess I was wrong.
The introduction of Camera.Render() shows an example, but it just render to texture. Does it mean this method cannot render to window?
I wanna close the automatic rendering, and the camera just render the scene when I call some method, meanwhile I wanna control the frame count of rendering, and get the duration of render…
Sorry, this is the first time I write a thread, maybe the question is unclear…
But I really need help.
That’s all. Thanks for reading.

You have to disable the camera first as it says, otherwise the camera will render automatically. It just lets you control when the graphics are actually drawn.

Could you give an example when this would be useful to use?

The textbook example would be using a RenderTexture.

In this case, the camera is disabled until you call Render() when you want to capture the camera view to ta texture.

1 Like

Thank you for your reply.
My test case shows that I use “camera.enable = false” to disable the camera, then the automatical render is stopped.
But after that, the camera.Render() seems like of no use. Just like I described before.
I just wanna know whether camera.Render() can only render to RenderTexture.
Because I use camera.Render() in Update() but the “Game” window didn’t show any thing…

What if I want to capture the view to window ?
And do I get one frame by call the method once ??
If it’s true, then I can render arbitrary number of frames by this way…

Thanks for all the replies.
I did some cases just now, and figure out that, I cannot use camera.Render() method to render to window, because once it was disabled, it couldn’t draw any thing on the screen, except for the Texture.

1 Like

I know this is an old thread, but it’s at the top of google for this type of search, and the comments here ignore important portions of the OPs question.

Disabling the camera and calling camera.Render() will work in a Build, but within the Play View in the Editor it will show “Display 1: No cameras rendering”. I can’t find a way to manually control the camera rendering, AND have it render in play mode.

For now I’m using #IF UNITY_EDITOR and falling back to a simpler rendering pipeline when I need to see things in the Play View.

In case anyone else finds this from some search engine, try building your game and see if it works. I was searching forever until I found a Reddit thread which had a couple hints about play view in the editor vs builds.

5 Likes

I think this behavior should be considered a bug. I also need to render my main camera manually, but can not

It just lets you control when the graphics are actually drawn.