Build scene with custom resolution

I know it makes little sense, but I would like to understand if it is possible to build a scene with an anomalous resolution, for example 1504 x 1150.
Is it possible to get a full screen with black sidebars and a resolution of this type?
I tried playing with the player settings, disabling the option, leaving and setting the resolution manually.
Also in some posts it is suggested to set but on Unity 2023 I was unable to find it.
Of course in Game View the resolution is set correctly.
If I start the application from the editor with the option the display is correct.
In the build, however, the image obtained does not respect the real proportions and the objects are out of place.
Am I doing something wrong or is it not possible?

Not natively (aka the things you tried) because the target hardware may not support such a resolution. You may have noticed that you cannot create a custom resolution in Windows. At least not without some nerdy tools.

But I think you can make your camera render to the desired screen dimensions, leaving black borders on two or all four sides. Can't think of a specific solution but it should be possible either via Camera settings, or by rendering the Camera to a RenderTexture and putting that RenderTexture on the screen and making sure it has the proper scale based on the actual screen dimensions. It may even be easiest to put that image in a UI Canvas with a Canvas scaler.

Just ideas for directions you could look into.

1 Like

I'll take a look at your suggestions, thanks so much!
But then I ask myself, what use can it be that Unity allows to set custom resolutions in Game View and to be previewed correctly in Play Mode if it is not able to represent the same scene in a build?

Because there are numerous valid resolutions spanning more than a dozen platforms and together there are countless hardware variations.

It's not like PCs have only 1080p and 4k. There are 32:9 aspect ratios all the way down to 4:3 or 5:4 with all sorts of resolutions. There are plenty valid resolutions and they change over time, yet you cannot just use any resolution in fullscreen but if you create a windowed or WebGL application, you are actually free to choose the resolution you please (for as long as it's less than the desktop resolution of course).

1 Like