- Home /
How to scale everything with screen size?
@karlkevin Dear community,
I'm developing a game for iOS and Android devices, but I have faced a big problem, what is scaling. I have almost completed my game and tested on iPhone 4S, and everything was beautiful, so I decided to test on iPhone SE, and evetything is not so beautiful anymore. I have made game with camera aspect ratio 2:3, but it still zooms in everything. The buttons are in place, because I have selected "scale with screen size", so my question is is there any way to do the same "scale with screen size" to everything else- sprites, pictures etc. Or do you know even easier solution?
Thank you for your help! :)
Answer by Raresh · May 03, 2016 at 10:01 AM
This is for just UI elements? $$anonymous$$y UI elements scale right, but other gameobjects don't
Somehow managed to make it scale, works for iphone with screen 320 x 480, 640 x 960, aspect ratio 2:3, but doesn't work with iphone tall aspect ratio 9:16. Any way to force game to this size?
Answer by Natrad · Mar 20, 2019 at 09:21 AM
Hi there, the same for me. After looking around on the internet about 2 hours :(. Watching a lot of tutorials video. Finally I found the full tutorial that solve this issue. Tested and it worked for me.
Hoping that will help you. Link: https://youtu.be/2uYkom__5zo
thank you. it work for me :))) Clear Voice version of video: https://youtu.be/oK9e-ZCDGEw
Answer by pramodRamdurg · May 03, 2016 at 10:45 AM
You can do this by using screen.dpi and scaling the objects according to it.
Screen.dpi will give you the density of pixel per inch of the device so using that number you have to recalculate your game objects scale.
Where should I use it? Could I just use Camera.main.aspect = floatnumber / floatnumber ? Or it won't work?
Answer by ranyelvicky16 · Aug 27, 2018 at 11:19 PM
@karlkevin..did u resolve the issue? if so how? may i know ,i am also facing the same issue now on android i have developed the game on 16:9 aspect ratio.
It works for me. Hoping that will help you. Link: https://youtu.be/2uYkom__5zo