- Home /
A problem involving RenderTexture, Canvas, and UI
This has been eating my brain for a few days by now and I wish I can get some wisdom from my good fellows here. I try to explain as best as I can below:
I work on a game where we switch between two different scenes rendered by two different cameras. Each camera renders directly into a RenderTexture. The reason it is rendered into a RenderTexture is that we want to apply effects while transitioning between the two scenes. Let's call these two scenes, scene A and scene B and camera that renders each scene is camera A and camera B.
I have a main camera also which I use for blitting with the OnRenderImage method. We have a shader that takes both RenderTextures from Camera A and Camera B and combines them using some effects.
In this game, some 2D/3D objects should be moved to the UI later at some point (e.g., inventory). The inventory also has it's own layout which is placed in the canvas. Now the problem is that because I use two RenderTexture I can't set the canvas to Screen space - Camera and my only option is Screen space - Overlay or world space. I really prefer to avoid world space because it would be much more complicated to setup everything and make sure that the UI correctly shows up under all situation. If I use screen space - overlay then the problem is that all 2D/3D objects that are moved to the UI during the gameplay would end up behind the canvas elements and I don't seem to have any way of making them go in front of canvas elements. Anyone has any ideas that could help me out here? I really appreciate your thoughts.
Your answer
![](https://koobas.hobune.stream/wayback/20220612163754im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Postprocessing effect in Oculus GO 0 Answers
how to make shader dont blend color with camera background? 0 Answers
Use camera depth texture to find distance from camera 0 Answers
RenderTexture clears after Blit 0 Answers
Prevent Render Texture clearing 1 Answer