Not sure how to adjust my code to prevent error

Godot Version

4.5.stable

Question

I am trying to implement a toggle button in the settings window that toggles fullscreen mode. However, I am getting a “Embedded window only supports Windowed mode” error. Below is how I have the buttons arraigned:


When you press the “Settings” button, the Settings screen pops up. The nodes of the Settings screen is as follows:

They are all under a Control node.

All the code related to the Settings screen is as follows:

func _on_settings_toggled(toggled_on: bool):
	if toggled_on == true:
		nine_patch_rect.show()
	else:
		nine_patch_rect.hide()

func _on_ok_button_pressed():
	nine_patch_rect.hide()

#Change window display to a display that is compatible with fullscreen mode
func _on_check_button_toggled(toggled_on: bool):
	if toggled_on == true:
		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
	else:
		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)

How do I code the screen so the fullscreen is toggle-able?

1 Like

Don’t run in embedded mode.

I did some more tinkering. For anyone who faces a similar problem, I found the solution is to make the mode Fullscreen. Project > Project Settings > Display > Window

1 Like