- Home /
Howto render camera into texture while still rendering into scene view?
I'm writing an editor script and I want to include a preview of the current camera while still displaying the main scene view. I can do the preview fine, with a render texture, however when I render into this RT it removes the camera from the main scene preview.
Is there a way to render into a RT while still displaying the camera view in the main scene?
I'm sure I can duplicate the camera and settings to accomplish this, but not sure if an easier way exists.
Any thoughts on how to go about this?
Answer by reissgrant · Aug 12, 2011 at 07:07 PM
Solved by setting the camera target texture to null right after rendering it:
mainCamera.targetTexture = renderTexture;
RenderTexture.active = renderTexture;
mainCamera.Render();
screenTexture.ReadPixels( new Rect(0, 0, width , height ), 0, 0 );
screenTexture.Apply(false);
RenderTexture.active = null;
mainCamera.targetTexture = null;
Hi @reissgrant could you tell me what is this screen texture?
Your answer
Follow this Question
Related Questions
Masking camera from rectangular to arbitrary shape 0 Answers
what does Camera.targetTexture do? 1 Answer
Error node.m_Bounds.IsValid() on UnityEngine.Camera:Render() 1 Answer
Capture RenderTexture pixels multiple times in one frame? 1 Answer
Render a GameObject/mesh to a -transparent- texture at run-time 2 Answers