Hello everyone, I'm trying to implement different resolution settings to my game, I think I've nailed the script down but for some reason changing the resolution only zooms in or out and I tried many settings between stretch modes and stretch aspect but all of them seem to lead to the same result:

(standard res)


This is what I do to change the resolution from the menu (resolutions being an array containing Vector2s of the resolutions)

get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_VIEWPORT,SceneTree.STRETCH_ASPECT_KEEP,resolutions[index])
get_tree().get_root().set_size_override(true,resolutions[index])
get_tree().get_root().set_size_override_stretch(true)

It may be a very simple issue but I can't figure out for the life of me what is wrong,
Thanks to everyone in advance.

You may also have to change the viewport size.

var viewport = get_viewport()
viewport.size = resolutions[index]

You can also change the window size.

OS.set_window_size(resolutions[index])

    cybereality Just tried it but unfortunately it doesn't seem to have improved anything, also OS.set_window_size = resolutions[index] spits out this error: Invalid set index 'set_window_size' (on base: '_OS') with value of type 'Vector2'.

    cybereality Tried with that but still it just zooms out, the window is larger but it's still zoomed out

    What are you actually trying to change? You shouldn't need to mess with any of those settings, they should just be set once in the project settings and work at any resolution.

      cybereality I set 1080p as default and I assume that with different monitor resolutions it would just upscale or downscale from 1080p to fit any other resolution, I wanted to make sure that the game was actually rendering at those higher or lower resolutions, are you saying that I shouldn't be messing with those settings because the scaling is good enough or did I get that completely wrong and the rendering resolution will change automatically to fit the higher resolution displays? (if that's the case I hate myself as it took me way too long format the menu)

      It depends on the setting. But if you select Viewport Stretch and Aspect Keep, then it will look the same on all monitors, more or less. If there is a large difference, there may be some blurriness due to the interpolation (not a problem on 3D games, but on 2D pixel art it can be noticable). However, the game will be the same size (you will not see more or less of the game level).

      You can test it by setting your monitor to different resolutions in the operating system and then loading the game. If you are on Windows, you can use Nvidia DSR or AMD VSR to "fake" a 4K monitor or 1440p monitor to use for testing.