Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change project display size property programmatically in mono #36843

Open
rafaelgdp opened this issue Mar 6, 2020 · 2 comments
Open

Comments

@rafaelgdp
Copy link

Godot version: 3.2.1 RC2 Mono Version

OS/device including version: MacOS Catalina. MBP 2018.

Issue description: Changing window size programmatically in the ProjectSettings singleton takes no effect.

Steps to reproduce: Create a Godot mono project with any resolution different from the bellow example. Create a scene and attach a C# script to it with the following code in the _Ready() function:

ProjectSettings.SetSetting("display/window/size/width", 200);
ProjectSettings.SetSetting("display/window/size/height", 100);

GD.Print($"{ProjectSettings.GetSetting("display/window/size/width")}");
GD.Print($"{ProjectSettings.GetSetting("display/window/size/height")}");

This print actually prints the values you set right before, but the actual window size does not change from the one you set in the project settings inside the Godot editor.

Minimal reproduction project: NA

@Calinou
Copy link
Member

Calinou commented Mar 6, 2020

This is intended, as project settings are only read on startup. Instead, set OS.window_size directly. For instance, in GDScript, you'd do:

OS.window_size = Vector2(1280, 720)

We started warning about this in front of some project settings in the class reference, but doing so for every setting would be kind of tedious 🙁

@git2013vb
Copy link

This is intended, as project settings are only read on startup. Instead, set OS.window_size directly. For instance, in GDScript, you'd do:

OS.window_size = Vector2(1280, 720)

We started warning about this in front of some project settings in the class reference, but doing so for every setting would be kind of tedious slightly_frowning_face

Hi, your suggestion seems not working in C# ( I didn't tried in GDScript).

in C# I use:
OS.WindowSize = new Vector2(800, 600);
But if I set in project properties 1920 and 1080 the statement doesn't work.
I miss something?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants