Camera doesn't render to RenderTexture in editor.


in my game I have a camera that renders to a RenderTexture like this:

renderTexture = new RenderTexture ((int)size.x, (int)size.y, 32);
GetComponent<Camera> ().targetTexture = renderTexture;

When it renders on the device it’s fine. When it renders in the editor it looks like this:

Is there anything I can do about that? I tried to change the texture depth and all that but to no success.

The thing is, that I can’t continue on my project now because of said problem.

Thanks for your help in advance.


Turns out that you can’t have the camera’s clear flags set to “Don’t clear” but to a transparent solid color.