Properties from window "Project Settings"

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DimitriyPS
:warning: Old Version Published before Godot 3 was released.

I want in a running project using a script to change the properties of the window “Project Settings”. As from a script to reach out to these properties?

:bust_in_silhouette: Reply From: Akien

You can use the Globals singleton for that: http://docs.godotengine.org/en/latest/classes/class_globals.html

For example:

if not Globals.has("display/height"):
    Globals.set("display/height", 768)

Happened. It works )))

Akien, tell me please, there is such a property:

“Project Settings” => Render => shadows_enabled

I understand that global variable should enable/disable the shadows. But as I have not tried it - it changes nothing. What is this variable?

DimitriyPS | 2016-07-27 07:11

:bust_in_silhouette: Reply From: splite

In Godot 3.0 its not Globals, its new ProjectSettings.

You can hover your mouse over property to see exact path:

(i hovered on Width, not Height + its in czech language partly)

if not ProjectSettings.has("display/window/size/width"):
    ProjectSettings.set("display/window/size/width", 1024)
if not ProjectSettings.has("display/window/size/height"):
    ProjectSettings.set("display/window/size/height", 768)

But AFAIK that if is alway false (ProjectSetting alway have value), so, better example is fulscreen Panel:

func _on_visibility_changed():
	if self.visible:
		$Panel.rect_size = Vector2(
			ProjectSettings.get("display/window/size/width"),
			ProjectSettings.get("display/window/size/height")
		)

In the particular case of making the Panel or any Control node fullscreen, it’s better to use the Layout button from the Toolbar.

Dlean Jeans | 2019-07-25 10:46

yeah, that was just first (not IRL) example that occurred to me.

splite | 2019-07-26 08:06