- Home /
Scaling game to fit screen size
Hey, I'm having problems with scaling my game to fit all mobile screens. So this is my Canvas Scaler:
I didn't really understand the Reference Resolution thing so, for now, it's set to my screen size. I also messed with anchors a bit. When I started I anchored all my UI elements to the sides of the screen I wanted them to stay close to.
Now I have 2 problems:
The first one is that I separated my UI elements into different logical groups, and each group is inside its own empty game object. Thing is, now the anchors are on the sides of this empty game object instead of being on the canvas. What can I do with that?
The second problem is that after I make my UI look good, what about the game itself? The UI might fit into any screen, but for example, on a screen with a smaller width, my player can travel outside the screen. (the player moves right and left). Another example is my background being cut to fit the new screen size. How do I fit the whole game into the new screen size, and not only the UI?
Thanks!
Answer by FakeMelon · Mar 24, 2018 at 02:03 PM
About my second problem, I fixed it with adding black bars for different aspect ratios as this wonderful video explains: https://www.youtube.com/watch?v=hXU-ZJb6GHw
Still got the first problem with my UI. can't anchor like I used to because my images, texts and buttons are inside an empty game object and not directly beneath the canvas.
Answer by Natrad · Mar 20, 2019 at 08:17 AM
I found the full tutorial that solve this issue. Tested and it worked for me.
Your answer
Follow this Question
Related Questions
World Space UI Scale To Fit Screen At DIfferent Aspect Ratios 1 Answer
Standalone build with 3:2 aspect ratio 2 Answers
Screen to canvas space 2 Answers
Making objects be at size and place for every phone size 2 Answers
Is there a way to change UI Scale Mode without causing my UI to mess up? 1 Answer