I have a fairly simple project that requires some slightly complex scene management and I’d like to control the draw order of cameras in the scene.
I have:
- A master scene that displays a second scene via a rendertexture.
- A second scene (loaded via Application.LoadLevel) that is loaded and then set up to render to a texture for display in the first scene.
- A handful of other scenes that are each set to render to a texture through their individual cameras and then used by the second scene (their render texture targets are planes in the second scene).
The problem is that unless I get lucky, the draw order is incorrect and the second scene gets rendered before the 3rd scene that it gets its rendertexture from. I have a scenemanager that puts each scene into its own layer and filters its camera by that layermask so the seperate levels can be worked on by different content creators and added to the gallery-like scene at runtime. However I don’t see a way to make the cameras from the most recently loaded scenes get drawn before their target textures are used by the other scenes.
Since there’s no way to load a scene without it being added to the global hierarchy, this is a tricky problem. Any insight would be appreciated. Really I’d like to be able to load a scene and then insert it to the front of the renderqueue. Setting the renderQueue on a material isn’t an option because the camera render needs to happen before its texture is used during the render of another camera.
A priority that applies to Cameras rather than materials is what I need but any alternative or workaround would be great.
Thanks,
Sam