StageDisplayState isn't being set properly at runtime, but does work later

Hi there.

Possibly a stupid question, but I’ve made a full screen toggle for a game, which then saves the setting for next time the game is run. Changing the settings works fine when it’s fired by a mouse click (i.e. in my options screen when I set the value, the app comes in and out of full screen mode quite happily).

However, when I re-run the game and load in the setting, the fullscreen code seems to be ignored, and my app doesn’t toggle (the setting is definitely loading in correctly, the issue is just with the StageDisplayState call). My default in project.xml is to run full screen, but there’s a user setting to run windowed - this isn’t working. However, if i then go into my game’s settings screen and click a button to re-set it, the same code works again.

Is there some reason it would only work when I click to toggle it, and not at runtime?

if it’s html5 it won’t let you start with fullscreen. it requires user interaction.

Ah, I should have said, this is a Windows/Mac application.

OK I figured it out - removing the fullscreen setting in project.xml did the trick. Rather than trying to override it, I just set fullscreen or not in the code and don’t worry about it being in the XML. Works great.

1 Like