How to set and fit the ui texts with full screen in unity version 6?

in the editor it does not matter if i set the resolution in the game view to my pc resolution 1920x1080 or to free aspect.

the only thing is matter that in free aspect i can see everything bigger and it’s easier to handle and see things.

but isn’t 1920 x 1080 is the actual what i should see in the build? after building the game and running the exe file, should i see the same settings i see as they are in the editor?

because this is how the build look like when running the exe file.
the full screen is fine but the ui text too small and not fit, unlike in the editor in the build there is not enough gap for the ui text above the map the maze grid and the ui texts also not in place like they are in the editor.

and if i change the camera size then the map the maze grid becomes too big inside the game view window.

Full screen when running the build exe file but the ui texts not in place and no gap on the top:

and this is the editor resolution is set to 1920x1080 and it looks too small and also the ui texts too small and not in place.

when resolution in the game view is set to 1920x1080:

now in this screenshot image i changed the resolution in the game view to free aspect and now the whole map maze grid is much bigger and easy to see.

but now again the ui texts too small and not in places and if i will do set them in places in build when running the exe file, they will not be in place. same problem when the resolution in the editor is 1920x1080 when i set the ui texts in the right places in the build exe file they will not be in place.

game view resolution is now set to free aspect:

and this screenshot show the resolution settings in: Edit > Project Settings… > Player > Resolution and Presentation.

resolution is set to 1920x1080 and full screen window:

and i have tow canvases in the hierarchy and both have the same settings:

-screen space overlay
-scale with screen size
-X 1920 Y 1080
-match 0.5

canvas settings:

i can’t find the “perfect” balance between the editor preview in the game view and the build exe file, in each it looks different, and the game view screen is never easy to look at, sometimes too big or too small.

Maybe debug that the othrographic size of your camera isn’t changing somehow.

The UI scale looks the same but your camera appears more zoomed in, ergo a smaller orthographic scale.

In any case, Free-aspect should really just be used when you’re testing/playing around with things in the editor. Otherwise you should always be using set resolutions to see how your game should look when running/built.

This is one of the cases where the “middle ground” is suboptimal. IMO the Match setting should be either 0 or 1 respectively Match Mode should not be “width or height” because in most cases you want the UI to scale with either width OR height, not both.

The 0.5 makes most sense when you have a wide variety of aspect ratios to deal with, ie mobile where the app can be run in both portrait and landscape mode.

On desktop however, you want to align only with height so the UI best matches the most common ratios 16:9 and 16:10 and all the way up to 32:9 (yes, that’s a thing!). With a match of 0.5 the UI would scale bigger on a 32:9 than it would be on a 16:9 even if the game doesn’t use any of the extra screen real estate.

Generally speaking you will engineer a suitable balance, not “find a perfect” one.

Here are the official docs on how to make your UI handle various resolutions and aspect ratios cleanly:

Here are some notes on UI Anchoring, Scaling, CanvasScaler, etc:

Usually you need to choose a suitable ScaleMode and MatchMode in the Canvas Scaler and stick with it 100%. Generally if you change those settings you will often need to redo your UI entirely.

Here’s some more fit-inside-UI-content notes:

I also use this CanvasScalerOrientationDriver utility to make sharing UI for Landscape / Portrait easier. Read what it does carefully.

Generally cameras are tied height-wise to the .orthographicSize, or the .fieldOfView

You can test directly in the UnityEditor Game window by choosing custom aspect ratios and pixel ratios, and you should do this for all anticipated major screen geometries, then test and fix your program until it works the way you want.

To tie it to the width, use ratios with the Screen.width and Screen.height, or alternately whatever pixel viewport you are rendering to. Remember those are integers so dividing them properly requires casting at least one of them to a float