Search code examples
unity-game-engineunity3d-gui

Unity Canvas does not fill screen


I have a 2D game set to 1080p pixel size (so each unit equals 1 pixel) and I have added a canvas to my scene. However the canvas fills only about 1/8th of the screen and is also not central either. All the canvas size and position settings are locked so I cant move it or resize it. The canvas itself does reflect the screen (ie if I put text in the top right corner it appears correctly) but the size makes it hard to judge where best to position the elements).

How do I get the canvas to fill my scene?

Image showing canvas in my scene

enter image description here


Solution

  • On your canvas, set the Canvas Scaler component's Ui Scale Mode to Scale with Screen Size. Then you can define a Reference Resolution of 1080p, i.e. 1920 x 1080.

    EDIT: To see the canvas fit into the camera's size in the scene, change the Canvas component's Render Mode to Screen Space - Camera, and drag the camera from the hierarchy to it.
    (check this video)