Unity3D UI Tutorial - How to scale the canvas for all screen sizes

Scott Durkin · 166K views · 2017 · 5:15

Open on YouTube

Indie game developmentGame programming & enginestutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about making Unity UI fit multiple screen resolutions, especially mobile devices, using the Canvas Scaler.

Recommended by 3 people across 3 different months, 2019 to 2021.

What it is

A five-minute Unity3D tutorial showing how to configure the UI Canvas so interface elements scale correctly across different screen sizes and aspect ratios. It is presented by Scott Durkin on his Unity 3D With Scott channel and is aimed at beginners.

What people said

Recommends gameDev_Unity · 2019-12 · Stack Overflow · on “Unity Canvas "Scale With Screen Size" makes Elements unseeable in lower Resolutions”

You should set the Scale With Screen Size option before adding any thing to canvas. Readjust the text object by setting the Game tab resolution to the one you have given as reference in Canvas Scaler . This tutorial might help you more : [this video]

Recommends CptNaed · 2021-05 · Stack Overflow · on “UnityEngine screen size fit every Android device”

You need two things for a 3D game 1-) Optimizing the canvas : [this video] 2-) Optimizing the camera angle (if you want it) Optimizing the camera for every screen resolution may not be as easy as canvas. For this, you can take certain standard resolutions with (Get in start Script). Let's set the filed of view of the camera accordingly at Scene Start. public class CameraOptimize : MonoBehaviour { // ======== private void Start { CameraOptimizer(); } private void CameraOptimizer { if (Screen.height == 2560 || Screen.width == 1440) { Camera.main.fieldOfView = 65.0f; } else if (Screen.height == 1920 || Screen.width == 1080) { Camera.main.fieldOfView = 75.0f; } } }

Recommends Gabriel Bigardi · 2021-08 · Stack Overflow · on “Best way to handle multiple screen aspects on mobile”

The best way is by using a Canvas Scaler and making good use of the anchor-point of the UI elements in your scene and using Layout Groups, this way they will fit nicely into almost all of the aspect ratios. A few videos covering these topics: Jimmy Vegas [LINK] Unity 3D With Scott [this video] Cat Trap Studios [LINK]