0
\$\begingroup\$

I have a layout for my game similar to this:

enter image description here

Where the light gray area is reserved for HUD elements and the dark gray area is reserved for the actual game. One function I want to offer in the dark gray area is the ability to zoom and move around, which works independently from the light gray area, meaning that no matter how far I zoom in/out or how far I move, the light gray area remains unaffected.

How can I do this without always taking the offset center into account? How can I completely separate the game play part and the HUD?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

You can set your UI Canvas to render in ScreenSpace - Overlay, so it's mapped to the screen/window, layered on top of everything at the end of the rendering passes, independent of any camera.

You can configure your camera to render to only the bottom-right section of the screen/window by configuring its viewport rect in the inspector or via script.

For example, to render the camera's view to only the bottom-right 80% of the screen/windows's width & height, you'd configure the viewport rect to:

x: 0.2   width: 0.8
y: 0.0   height: 0.8
\$\endgroup\$

You must log in to answer this question.