Change resolution without changing window size

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Afely

I’m trying to implement an option to change the resolution of the game, and I can’t find a solution for how to do it anywhere. I just want to change the resolution, like if I were to go into project settings and change the window size from there. It seems pretty simple to me but I can’t figure it out. I’ve tried a lot of stuff already and nothing has worked right so far.

:bust_in_silhouette: Reply From: exuin

Try using the Shrink setting instead. Multiple resolutions — Godot Engine (stable) documentation in English

This didn’t really work for me. It’s closer than what I had, but not quite. I want to change the resolution, but keep the window size and size of the game inside the window the same.

Afely | 2021-05-15 01:41

Hm, have you tried changing this setting through code? ProjectSettings — Godot Engine (stable) documentation in English

exuin | 2021-05-15 01:59

I did, it didn’t do anything.

Afely | 2021-05-15 02:14

Okay what do you mean that shrink doesn’t really work for you?

exuin | 2021-05-15 02:26

It did change the resolution, but when it did it made the game smaller inside of the window, which isn’t what I want. I want it to change the resolution but then scale it to fit the window size.

Afely | 2021-05-15 02:43

Is this a 2D game or a 3D game? And can you send me an example image?

exuin | 2021-05-15 03:37

It’s 3D, but I was testing the resolution changing in a 2D scene. Here’s an image of the main scene, and the options scene I was trying to change the resolution in.


Afely | 2021-05-15 09:05

Shrink is meant for 3D and not 2D so try shrink on the 3D scene

exuin | 2021-05-15 09:11

See discussion in https://github.com/godotengine/godot/issues/14542.

For better usability, I would recommend exposing a rendering scale factor instead of an absolute resolution: https://github.com/godotengine/godot-demo-projects/tree/master/viewport/3d_scaling

Calinou | 2021-05-15 18:09