I have not tried this, but it should work. Create 3 layers (UIBackground, World, UI) - most of these exist by default, set up their render order in settings, assign cameras (I think single camera for all should work).
Thanks for responding! That is pretty much what I have set up. However, it seems the “2D Screen” entity is not respecting the layer assignment. Perhaps I am misunderstanding how the 2D Screen entity works.
I have my 3 cameras set up how you described, but when I place a 2D Screen under the UIBackground camera, it does not render.
Sure, I set up a public project with the setup I am trying to accomplish. I think I have the layers set up correctly, but now when I try to run it, I get an error:
[[playcanvas-stable.dbg.js:12626]](https://code.playcanvas.com/playcanvas-stable.dbg.js): Cannot read property 'x' of undefined
TypeError: Cannot read property 'x' of undefined
at ForwardRenderer.renderShadows (https://code.playcanvas.com/playcanvas-stable.dbg.js:12626:42)
at ForwardRenderer.renderComposition (https://code.playcanvas.com/playcanvas-stable.dbg.js:13801:11)
at Application.render (https://code.playcanvas.com/playcanvas-stable.dbg.js:48708:18)
at Application.tick (https://code.playcanvas.com/playcanvas-stable.dbg.js:49291:17)
at Application.start (https://code.playcanvas.com/playcanvas-stable.dbg.js:48676:9)
at Application._preloadScripts (https://code.playcanvas.com/playcanvas-stable.dbg.js:48468:5)
at done (https://code.playcanvas.com/playcanvas-stable.dbg.js:48410:6)
at Asset.onAssetLoad (https://code.playcanvas.com/playcanvas-stable.dbg.js:48422:7)
*Edit: The issue seems to be coming from the light and specifically casting shadows. If I turn Cast Shadows off, the error goes away. So any insight on how adding my layer created an issue with casting shadows?
I actually ran into this exact same issue yesterday. I had a second camera that was only rendering a new layer I had created called Background. The objects on the background layer all had shadow casting / receiving disabled, and the only light in the scene was casting on the World layer only.
The only way I was able to get the error to stop was to disable shadow casting on the light. I ended up finding a workaround that let me render everything with a single camera and ditching the background layer. I can recreate it in a new project if that’s helpful.