How to set screen resolution in unity and then scale to fit window size

Viewed 36

Trying to get Gameboy resolution which is 160px x 144px in unity and then the game will scale up when in full screan with bars around the side where the aspect ratio doesn't fit. But it still only has 160 "pixels" just scaled to take up however many pixels it takes

1 Answers

You could start by reading the documentation file on "Resolution and Presentation"

here is the link: https://docs.unity3d.com/Manual/class-PlayerSettingsAndroid.html#Resolution

and this forum page also seems to be helpful:https://forum.unity.com/threads/target-dpi-vs-render-scale-vs-resolution-scaling-fixed-dpi-factor-vs-setresolution.1076789/

Now based on these two I would consider this to be your solution:

Go to Edit > Project Settings > Player (on the left list) > Resolution and Presentation

once you are here find the Resolution Scaling Mode option and set it to Fixed DPI as shown in this Image

Once you do that you get the option to choose a number between 30 to 1000, which you would decide based on the output screen you target. If the number you set is lower than the screens native dpi, your game will upscale and by the same reasoning, I would say it would downscale if you set it higher than the native dpi of the target screen. I am not 100% sure this is the solution to your problem, but I hope it sets you up on the right direction.

Related