Hello, i am making a 2d game.
There i am using ui buttons to perform certain actions.
In my engine everything looks fine, the ui button is placed at the top-left corner.
Then the game is built and play the ui buttons are in different places (a bit to much in Y or X).
Everything looks more horrible when playing it on different computer with different resoultion monitor.
How do i fix that, the ui needs to be updated with the screen resolution size.
(sorry for bad enghlish)
Hi there!
How are you placing your UI buttons? On a UI Canvas object or 2d Sprites?
You can always check āEdit > Project Settings > Playerā to view the Resolution settings.
Docs here:
https://docs.unity3d.com/Manual/class-PlayerSettingsStandalone.html#Resolution
Hi, i am placing on UI canvas.
Basically i want the UI stuff to update to the windows size
If you want your UI to remain the same size relatively on screen no matter the resolution, change your Canvas Scaler to by Height and slide the slider all the way to the right to Height. When you make your UI make sure you properly use the Rect pivot and anchors and dont simply drag the objects from the center of the screen.
You should change the UI Scale Mode of your Canvas to āScale with screen sizeā and set your anchors to the correct position.
Hi, new reply, old question, possibly simple solution in newer versions of Unity (Iām using 2019.4.28f1 LTS). I found this after poking around a bit.
Go to your canvas object and in the Inspector window > Canvas Scaler > UI Scale Mode > Scale With Screen Size
Works for me. Hope this helps somebody. Here is an image also;
Iām having a similar problem, but what I need is the Screen Match Mode to be 0 normally, but be changed to 1 if a Fold phone is detected.
I have no issue with the detection of a folding phone.
The problem I have is finding the code or keyword I need to use to change āScreen Match Modeā to 1 when a Folding phone is detected.
EDIT: Found my solution here: CanvasScaler current scale?
This thread is on the wrong sub-forum as itās about UGUI not 2D. Iāll move it for you.
