When I build and run my game, the resolution is different than in editor.
Note: My monitor’s display settings are 2560 x 1440.
My editor’s game display is set to Full HD (1920 x 1080).
I have UI positioned just outside of my canvas so that it does not display until needed:
This looks fine in the editor and the UI is not visible.
When I build my game using the settings:
Edit > Project Settings > Player > Fullscreen Mode > Exclusive Fullscreen This is what I see:
Changing Fullscreen Mode to Windowed and specifying 1920 x 1080, makes it display correctly.
But then if I maximize the window using the above settings it displays incorrectly again:
I believe the issue that is occurring is that when the game is full screen, it is displaying in 2560 x 1440, my monitor’s resolution, rather than 1920 x 1080.
I’d like my game to always look the same, displaying in 1920 x 1080 resolution. So, even if the window is maximized, it will just stretch the image, rather than show more of the game, revealing the UI.
Is any one able to provide me with the correct settings I should be using? Thanks so much!
The game will always run at whatever the monitor or window resolution is by default, unless you override the allowed resolutions in the player settings.
But might I suggest an alternative solution … scale the UI instead.
On the Canvas for the UI, there should be a scale option. By default it’s set to Constant Pixel Size. Change that to Scale With Screen Size instead. Realistically the vast majority of games use that setting instead of using a constant pixel size.
Though, I’d like to understand this better. If I want my game to be full screen, how can I override the allowed resolutions in the player settings?
To clarify, I don’t want players with a larger monitor to see more of my game compared to players with smaller monitors.
I want my game to always be full screen and keep the 1920 x 1080 resolution, even on larger monitors.
A 2560x1440 render won’t see any more than a 1920x1080 render does. More detail maybe, but what you see is defined by the camera frustum, not the resolution. The one caveat is wide screen resolutions will see more as it’ll widen the horizontal FOV.
There are multiple threads on how to enforce specific aspect ratios, though I believe the recommended method these days is to use a camera rect.
You can limit the resolutions the application will run at, but people can modify the settings manually to force any resolution they want. So it’s better to limit it in other ways.
This is in regards to dealing with a wider monitor’s horizontal FOV, right?
I just want to make sure I’m keeping up with you:
Changing my Canvas Scaler to Scale With Screen Size solved the UI problem. So, aside from wider monitors, player’s with a typical 16:9 aspect ratio monitor (2560 x 1440 or 1920 x 1080) should be seeing the same thing.
Separately, enforcing the 16:9 aspect ratio with Camera Rect is how I can prevent players with a wider monitor from seeing more of the game. Did I get all of that right?
Thanks again so much for sharing your brain with me. This has been extremely helpful!