Change to fullscreen on the fly?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By fpicoral

How can I change to fullscreen on the fly?
I used the code below but the game was only in fullscreen after restarting the game

ProjectSettings.set(“display/window/size/fullscreen”, true)
ProjectSettings.save()

What I thought that could be a sollution was to set the window height and width to the player’s display height and width. I thought that I could het the player’s display size using OS but I figured out that I can only get the game window size, so it has no use on this situation.

So, is tuere a way to change to fullscreen without needing to restart the game?

:bust_in_silhouette: Reply From: Tova

try to set OS.window_fullscreen to true from code
also if you want to make it so that you can turn it off again you could use:

OS.window_fullscreen = !OS.window_fullscreen

try to use this code on a button