Forum rules - please read before posting.

Resolution Chooser reverts to option #1

I've built the Resolution Chooser outlined in the tutorial at https://adventurecreator.org/tutorials/adding-screen-resolution-option

Everything works as expected and upon reopening the app, the saved resolution is restored. However, when I return to the options screen, the starting resolution of 800 x 600 is reset and you are forced to re-select the preferred resolution. Is there some call in the pulling up of the options menu that calls the ActionApplyResolution call before checking to see what the saved resolution index is?

Comments

  • The Cycle element is linked to the ScreenResolution variable, which should be linked to Options Data so that its value is automatically restored upon restarting.

    Is this the case? If the resolution itself is correct, then so too should be the variable - since that also reads this value.

    Try running a Dialogue: Play speech Action with the variable's token as speech text. The token can be copied from it's properties box in the Variables Manager - what value does it display?

  • edited September 2022

    I discovered what the issue was. I had added a fullscreen toggle to the InitResolutionVariable, but I got the Variables of the resolution setting and the fullscreen setting mixed up. After I discovered this and added the correct Variable

    void InitResolutionVariable()
    {
    GVar variable = GlobalVariables.GetVariable(16); // Replace '0' with your own variable's ID number
    variable.BooleanValue = Screen.fullScreen;

        variable = GlobalVariables.GetVariable(12); // Replace '0' with your own variable's ID number
        if (variable.IntegerValue == -1)
        {
            for (int i = 0; i < Screen.resolutions.Length; i++)
            {
                if (Screen.resolutions[i].width == Screen.currentResolution.width &&
                    Screen.resolutions[i].height == Screen.currentResolution.height &&
                    Screen.resolutions[i].refreshRate == Screen.currentResolution.refreshRate)
                {
                    variable.IntegerValue = i;
                    return;
                }
            }
            variable.IntegerValue = 0;
        }
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.