- Home /
How to adjust aspect ratio for any screen size
In previous releases of my game, some people complained that the game was too big for their screens. I have my game set at 1920x1080 and their screen resolution is smaller.
So how do I get my game to display properly on their screens?
Answer by NMJ_GD · Jun 03, 2020 at 07:48 AM
Firstly, What kind of game do you want to make 2d, 3d? Secondly, if you are using canvas it has canvas scaler component which you can add (play a little with it and you will easily get hang of it).
In addition, with UI you better start playing around with pivot points with which you can snap to the place it, too, helps quit a bit too.
Thirdly, if you are doing 2d game it is little easier (in my opinion given that i mostly work with 2d games). There are several ways you can go with it.
Easiest but not that good is writing a script which manually (manually because you do it with try and error method) changes the local scale of the object depending on the device you want to release (for example in case of IOS ex: UnityEngine.IOS.DeviceGeneration.iPhone11ProMax ,etc). not What good of a solution.
The Last option is starting using your mathematical skills and start computing using Screen.Width, Screen.Height, But you should know that it returns the numbers in pixel So for your 1920x1080, Screen.Width = 1920, Screen.Height = 1080.
Edit: PS. Dont forget that you can use simulators (they are pain in the a** to work with but you can still do it). The simulators would help you to see if your game properly does your screen resolution staff.
Your answer