I'm making a game that normally runs at a fixed resolution with viewport scaling so everything is pixel perfect, and I'm trying to add an option to the game that allows it to run with canvas item scaling instead, so the game runs at the monitor's resolution instead of its own fixed res. For whatever reason, though, simply setting the ProjectSetting in code doesn't seem to do anything. both set_setting() and set_initial_value() don't do anything, and the game just uses whatever I manually set in the editor project settings. Anybody know a solution or workaround?

Here's how I save and load the setting:

func _ready():
	visible = false
	await get_tree().create_timer(0).timeout #wait for the configfile to load
	load_settings()
func save_settings():
	save_value("video", "resolution",$menu/tabs/video/resolution.button_pressed)
	if saved_settings.get_value("video","resolution"):
		ProjectSettings.set_setting("display/window/stretch/mode","canvas_items")
	else:
		ProjectSettings.set_setting("display/window/stretch/mode","viewport")
func load_settings():
	file_loaded = false
	if FileAccess.file_exists(save_path): #check if a config file exists
		print("config file exists, loading...")
		saved_settings.load(save_path)
		print("file loaded, loading settings")
	else: #if no save file exists, create a new one
		print("no config file found, creating a new one...")
		save_settings()
		print("new config file created")
	$menu/tabs/video/resolution.button_pressed = saved_settings.get_value("video","resolution")
	if saved_settings.get_value("video","resolution"):
		ProjectSettings.set_setting("display/window/stretch/mode","canvas_items")
		print("native resolution enabled")
	else:
		ProjectSettings.set_setting("display/window/stretch/mode","viewport")
		print("native resolution disabled")

I'm not sure how to change it using set_settings. But maybe you can change it using:

get_window().content_scale_aspect = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS

and

get_window().content_scale_aspect = Window.CONTENT_SCALE_MODE_VIEWPORT

Other settings are found here:
https://docs.godotengine.org/en/stable/classes/class_window.html

    Memoni pls use block blocks for code uzing this ```

    Example
    ```
    some code
    ```

    And it will format the code like this

    some code