Forum rules - please read before posting.

Resolution Script

Hello, I followed the resolution tutorial and I got no error so far but when I build and try it. The game only changes 1 time the resolution an then it stays on that. I reopen game and try to change but its still on 640x480. What could be wrong? Here the Script and screenshots

`/*
*
* Adventure Creator
* by Chris Burton, 2013-2021
*
* "ActionApplyResolution.cs"
*
* This is a blank action template.
*
*/

using UnityEngine;
using System.Collections.Generic;

if UNITY_EDITOR

using UnityEditor;

endif

namespace AC
{

[System.Serializable]
public class ActionApplyResolution : Action
{

    // Declare properties here
    public override ActionCategory Category { get { return ActionCategory.Engine; }}
    public override string Title { get { return "Apply Resolution"; }}
    public override string Description { get { return "Change the Screen Resolution."; }}


    // Declare variables here


    override public float Run()
    {
        int chosenIndex = GlobalVariables.GetIntegerValue(3); // Replace '0' with your own variable's ID number
        if (chosenIndex >= 0)
        {
            Resolution chosenResolution = Screen.resolutions[chosenIndex];

            Screen.SetResolution(chosenResolution.width, chosenResolution.height, Screen.fullScreen);
            KickStarter.playerMenus.RecalculateAll();
        }
        return 0f;
    }


    public override void Skip ()
    {
        /*
         * This function is called when the Action is skipped, as a
         * result of the player invoking the "EndCutscene" input.
         * 
         * It should perform the instructions of the Action instantly -
         * regardless of whether or not the Action itself has been run
         * normally yet.  If this method is left blank, then skipping
         * the Action will have no effect.  If this method is removed,
         * or if the Run() method call is left below, then skipping the
         * Action will cause it to run itself as normal.
         */

         Run ();
    }


    #if UNITY_EDITOR

    public override void ShowGUI ()
    {
        // Action-specific Inspector GUI code here
    }


    public override string SetLabel ()
    {
        // (Optional) Return a string used to describe the specific action's job.

        return string.Empty;
    }

    #endif

}

}`

https://www.dropbox.com/s/3xdbgn5kt1xb8gp/resolution1.png?dl=0
https://www.dropbox.com/s/heselv057z01i2i/resolution2.png?dl=0
https://www.dropbox.com/s/o1oayd4cgbkfspe/resolution3.png?dl=0

Comments

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.