How to draw camera canvas on top of overlay canvas?
Using Unity to Draw Camera Canvas Above Overlay Canvas
In Unity, to ensure a camera canvas appears above an overlay canvas, adjust the Render Mode and Sorting Order properties. Follow these steps:
Steps to Implement
- Create UI Canvas
- Right-click in the hierarchy and select
UI > Canvas. - Set Render Mode to
Screen Space - Camera. - Assign your camera to the Render Camera field.
- Adjust Sorting Order
- Select the newly created canvas and locate the Canvas component.
- Set the Sort Order to a value higher than the overlay canvas.
- Configure Overlay Canvas
- Verify that the overlay canvas' Sort Order is set lower than the camera canvas.
Example Code Snippet
Canvas cameraCanvas;
canvas.sortingOrder = 1; // Set camera canvas order higher