How to allow *Portrait* resolutions in PC/Standalone ?

Hello,

I’m porting a mobile game on PC, and I would like for players to be able to select “Portrait-like” aspect ratios in windowed mode - like 3:4 or 9:16. I know it’s doable because I had the option some time ago : the drop down list in my built application had several “vertical” resolutions, named with an adjective in parenthesis next to it (“sided”, “rotated” or something like that - I can’t remember which one it was, which make research kinda hard).

I made some evolution, and now those vertical resolutions have disappeared from the list - and I can’t find a way to bring them back.

Does someone have any idea ?
Other alternatives are :

  • Disabling the resolution dialog
    entirely to manually set the aspect
    ratio (very bad)
  • Have the game only work with
    landscape-ish resolutions (look
    silly)

4 Answers

4

Hi,

I just found out the solution use default player settings in unity. And add this line into start function of any script. - Screen.SetResolution(1080,1920,true);

And just set your display resolution TO PORTRAIT MODE using display setting on windows. After that reopen unity and build it again.

Woola…! After you start your game you will see that your application in portrait mode.

do you think it is possible to also set just the aspect ration?

You can set any resolution value by yourself just write theses lines in your script.

private void Awake()
{
         Screen.SetResolution(450, 750, true);
}

***//Screen.SetResolution(int width, int height, bool fullscreen);

***//set bool value true or false depends on you if you set true in build game play in full screen mode if you set false game play in half screen,.

In the above scode

Render your Main camera to a Raw Image Inside a Canvas. Set the canvas to adapt the resolution size and fill the screen, set player resolution to fullscreen default resolution. And voila!

If you mean in build, go to the Player Settings → switch to PC → Resolution and Presentation. There you can find Fullscreen Mode = Windowed and set your prefered resolution to render in the build. You can support multiple builds with different resolutions.