Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 964
coolblue2000 Avatar asked Sep 02 '15 07:09

coolblue2000


People also ask

How do I make unity window full screen?

To set a standalone player to be full screen, go to Edit>Project Settings>Player and under the Resolution and Presentation heading, check Default is Full Screen . To change resolution to full-screen at run-time, you would just use [Screen. fullScreen][1] = true; .

How do I get UI to scale with screen size in unity?

In UGUI, you can set the Canvas to scale with screen size. For example, you can set the Reference Resolution to 1920 x 1080, and then place a button 200 x 200, and then resize the screen resolution to however you like and it will always keep the same exact scale ratio.


1 Answers

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)

like image 69
user3071284 Avatar answered Oct 16 '22 14:10

user3071284