I’m having some trouble on making my canvas scale with different screen ratios. When I have it set at 16:9, everything works perfectly, but as soon as I set it to 16:10 --or any other setting-- it all falls apart.
I am trying to make it so that the blue grid in the pictures above move from where they are now to the bottom of the screen, and out of view from the player --save for the button that will reveal it again when desired. The main problem with this mishap is that the grid is still visible due to the extended portion at the bottom of the screen, and because --as mentioned before-- I need to have a button still be visible so that the player can make the grid pop up again, I can’t shift it down more to account for the added space.
At first, I checked online and in many different forums to try and solve this problem, but all of them either didn’t do anything, or made all of the objects be shifted to the sides of the screen for some reason. Bellow is the settings I have for my canvas.
(Settings for canvas. As you can see, I also tried to use the Aspect Ratio Filter, but wasn’t able to get it to work.)
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.
I also use this CanvasScalerOrientationDriver utility to make sharing UI for Landscape / Portrait easier. Read what it does carefully.
Based on the forms that kurt-dekker sent above, I found the solution for anybody who is facing the same problem. I first changes all the transforms into Rect Transform’s, and then made the grid anchor to the bottom left side of the screen. Then I edited my code to change the position the grid is trying to get to be on the same x-axis that it’s currently on (due to how it is now anchored to the same relative x-axis position, no matter the resolution)