I'm learning how to make a browser game with Unity. I have set up the screen display dimensions to 960 x 640 (I read that it's a safe resolution to use. Feel free to correct me). I created a Canvas and set it to match with width or height, and I set Reference Resolution to 960 x 640.

The problem is that the canvas doesn't match the screen properly and empty leaves bars at the top and bottom. I get the same result using both Render Modes for Camera and Overlay. I understand that the matching options choose either width or height, depending on the slider setting.

Can I somehow match the canvas to the display properly?

Screenshot of the Canvas

Screenshot of the Canvas setting

Screen as displayed in the browser


1 Answer 1


I found the answer. I didn't realise I can set the game preview in Unity to specific a fixed aspect ration. The problem occurred because the Canvas were matching with the camera or screen size, and that preview window screen size did not match the desired 960 x 640. Apologies for a silly question. I haven't worked much with 2D games before.

  • 1
    \$\begingroup\$ "I can set the game preview in Unity to specific a fixed aspect ratio" - this answer would be better if it explained how to do that. \$\endgroup\$
    – DMGregory
    Dec 6, 2022 at 16:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .