+1 vote

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?

in Engine by (519 points)

1 Answer

+1 vote

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

by (181 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.