Godot Version
4.3
Question
what’s the correct way to toggle full screen / windowed mode?
I use this in a script:
var fullscreen = false
func _process(_delta):
if Input.is_action_just_pressed("full_screen"):
fullscreen = not fullscreen
toggle_fullscreen()
func toggle_fullscreen():
if fullscreen:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
This works at the beggining, but sometimes (always?) after a minute or so it starts to bring a millions of these errors:
E 0:01:16:0498 utilities.gd:25 @ toggle_fullscreen(): Parameter "hicon" is null.
<C++ Source> platform/windows/display_server_windows.cpp:3198 @ set_icon()
<Stack Trace> utilities.gd:25 @ toggle_fullscreen()
utilities.gd:10 @ _process()
And the game eventually crashes.
Thank you!