- Home /
Scaling problem for mobile
Hello everyone, I need some help with scaling my GUI to make it look good on mobile.
In the Unity Game Viewer the GUI is fine, I mean buttons and boxes look exactly how I want, but when I go mobile they look more little, I guess because of different DPI. I haven't found out a way to fix this issue, I tried with a scaling matrix and I end up having the right size, but the GUI goes off screen.
So, is there a way to fix this issue? Something that would "zoom" the GUI on mobile while keeping its position?
You have to set the size and position based on screen.width and screen.height. If you use absolute vaules, new Rect(10,10, 400, 200); they will be totally different on your mobile than they appear in the editor.
//Not the actual code, just an example. So if your screen is 480x800;
int width = screen.width;
int height = screen.height;
new Rect(0.1f*width, 0.1f*height, 0.25f*width,0.25f*height);
Sorry, I forgot to add that I already set everything according to screen size. The problem is for example that buttons' corners are "sharper" on mobile and the box border is more thin. It isn't a placement issue.
Yep, that's totally different that how I read it.