Forum rules - please read before posting.

Quality Settings Menu

Feature Request

Would be great to have Quality Settings as an option in the AC menus, so players can adjust resolution, v sync, etc. As a non-programmer, this feature would be a very welcomed addition to AC.

I know that you can display the resolution dialog in the default Unity settings but this is less than ideal for a few reasons: 1) It's an extra start up step that isn't always needed. 2) It can't be translated. 3) It can't be easily modified to contain the options you want and to remove those you don't. 4) The pop-up window is ugly.

Comments

  • My feeling is that there's really no end to the number of options one could introduce here, so it's best left to custom option data to handle.  Even for non-programmers, it's quite a simple process and is walked through here.

    To adapt the tutorial to work with quality setting instead of screen resolution, you mainly just need to replace Screen.SetResolution with QualitySettings.SetQualityLevel.
  • Yeah, I guess there would be a lot of options to integrate. That makes sense. Thanks for the tutorial tip, I'll try that out!
  • Hello Chris and hello to all the adventure creators,
    I'm linking to this post because I'm trying to add the quality setting to the options menu.
    Reading here, I understand that I just need to change the "Screen.SetResolution" parameter to "QualitySettings.SetQualityLevel".
    But it's not clear to me how to do that.
    Following the tutorial on the Adventur Creator site, I was able to set the resolution setting, but if I wanted to add the quality setting as well, would I basically have to duplicate the "ActionApplyResolution" script, rename it and replace "Screen.SetResolution" with "QualitySettings.SetQualityLevel"?
    Sorry if this is a wrong question, but I just can't figure out what to do:
    Should I do the same initial procedure? Create a Global Variable, get the ID, put it in the script.
    Would it be possible to have both choices in the menu (resolution and quality)?
    If you can, would you be so kind to add a tutorial?
    Surely this is a simple operation, but as I have no programming knowledge, I get lost in trying to visualise how to do it.
    Thanks

  • The process for quality settings is largely the same: create a new variable, and use it to record the player's choice, and then use that to apply the correct setting.

    The difference with Quality Settings is that - at least so far as I'm aware - it's not possible to extract the various options through script. So rather than having a script auto-populate the Cycle element's labels, you'd have to manually set them in the Menu Manager.

    Another Action wouldn't be necessary - you could update both settings in the one:

    using UnityEngine;
    using AC;
    
    public class SetupOptionsMenu : MonoBehaviour
    {
    
        void Start ()
        {
            GenerateResolutionCycleOptions ();
            InitResolutionVariable ();
        }
    
        void GenerateResolutionCycleOptions ()
        {
            MenuCycle resolutionCycle = PlayerMenus.GetElementWithName ("Options", "ScreenResolution") as AC.MenuCycle;
    
            resolutionCycle.optionsArray.Clear ();
            foreach (Resolution resolution in Screen.resolutions)
            {
                string optionLabel = resolution.width.ToString () + " x " + resolution.height.ToString () + " (" + resolution.refreshRate.ToString () + ")";
                resolutionCycle.optionsArray.Add (optionLabel);
            }
        }
    
        void InitResolutionVariable ()
        {
            GVar variable = GlobalVariables.GetVariable (0); // Replace '0' with your resolution 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;
            }
        }
    
        void InitQualityVariable ()
        {
            GVar variable = GlobalVariables.GetVariable (1); // Replace '1' with your quality variable's ID number
            variable.IntegerValue = QualitySettings.GetQualityLevel ();
        }
    
    }
    

    And:

    using UnityEngine;
    using System.Collections.Generic;
    #if UNITY_EDITOR
    using UnityEditor;
    #endif
    
    namespace AC
    {
    
        [System.Serializable]
        public class ActionApplyResolution : Action
        {
    
            public ActionApplyResolution ()
            {
                this.isDisplayed = true;
                category = ActionCategory.Object;
                title = "Apply resolution";
            }
    
    
            override public float Run ()
            {
                int chosenResolutionIndex = GlobalVariables.GetIntegerValue (0); // Replace '0' with your resolution variable's ID number
                if (chosenResolutionIndex >= 0)
                {
                    Resolution chosenResolution = Screen.resolutions [chosenResolutionIndex];
    
                    Screen.SetResolution (chosenResolution.width, chosenResolution.height, Screen.fullScreen);
                    KickStarter.playerMenus.RecalculateAll ();
                }
    
                int qualityLevel = GlobalVariables.GetIntegerValue (1); // Replace '1' with your quality variable's ID number
                QualitySettings.SetQualityLevel (qualityLevel, true);
                return 0f;
            }
    
        }
    
    }
    
  • Thank you Chris for always being so available.
    As soon as I get in front of the computer I will try.

  • Everything works perfectly, I replaced the first script to the file "SetupOptionsMenu.cs", the second script to replace the file "ActionApplyResolution".
    I created a Global variable named quality, to which I gave Integer -1 connected to Option Data.
    In the two scripts I replaced the IDs with those of the two Global variables.
    In the Options Menu I duplicated the ScreenResolution element renaming it "quality", reassigned its Global Variable, and changed the number of choices to 3 (low, medium and high).
    Then in the Project settings of Unity under Quality, I left the 3 levels that interested me "Very Low", "Medium" and "ULtra", eliminating the others.
    Everything went smoothly, now after making the build, from the menu I have the possibility to set the graphic resolution and the level of detail.
    Thanks Chris

  • Just a word of advice for letting players feedle with your game settings, like Vsync for instance.
    I have recieved few complains that some graphics like sprites and GUI breaks down and randomly appear and disappear.

    Because those few have some super powerful stations and for no reason push thier computers to the limits playing little indie games. I mean it is not a heavy shooter where you need high frame rate, but they don't care and burn energy along with GPU.
    Of course it depends on how you built your game. But I forced frame rate to 60. and now it works fine on any station.

  • Hi SkyTree, thanks for the clarification.
    I thought about adding the graphics quality, because being my first experience with AC and Unity, in my little experience I probably don't know of any tricks that can streamline the amount of calculation.
    It's a 3D adventure, I've kept assets really low in polygons, but in the scenes, I've worked a lot with real time lighting, Partcle System and soft shadows.
    I think that this causes some jerks and lag on older computers that make the gaming experience difficult in some places.
    Now with the graphic levels selected low, I get a good increase of FPS because the details are reduced a lot, the shadows are canceled and the number of lights is decreased.
    I think this way the player can run the game even on low end computers or at least I hope so.

  • Hi guys (excuse my English),
    I have a question regarding the possibility to enable or disable a camera component and insert this feature in the options menu.
    In my case it is the Tool Aura2 that if I understand correctly is a component of the main camera used on AC.
    Since Aura 2 works on volumetric lights, its use is quite heavy, and I thought to insert in the game options the possibility to turn it off or on so that the player can decide whether to use it or not.
    So the procedure I think I'll have to follow will be similar to the one used to set game resolution and graphics quality.
    That is to have a script that refers to a global variable, take its ID and so be able to control the camera component (Aura2).
    Since I have no programming knowledge, is there anyone who could kindly pass me the lines of code to do this?
    If I have been unclear or you need more information please let me know.
    Even if there are alternative ways that are fine.
    Thank you for your attention.

  • As a simple on/off toggle, you'd want to rely on a Global Boolean variable, linked to Options Data, to control the state. You can use a Toggle element to control its value, and wouldn't need any extra script to update the display. If you're following the tutorial, you can do without the SetupOptionsMenu script for this.

    However, the custom Action's Run function would then instead be:

    override public float Run ()
    {
        bool isEnabled = GlobalVariables.GetBooleanValue (0); // Replace '0' with your own variable's ID number
        KickStarter.mainCamera.GetComponent <MyComponent>().enabled = isEnabled;
        return 0f;
    }
    

    You'll need to replace "MyComponent" with the name of the Aura component attached to your MainCamera, though.

  • Thanks Chris, in the end I decided to implement the lines of code you wrote, and I added them to the existing script you created for me some time ago.
    Now everything works, accessing a single script I can control resolution, quality and activate the component camera.
    I leave here below the modified script that could be useful.

    using UnityEngine;
    using System.Collections.Generic;
    using Aura2API;
    #if UNITY_EDITOR
    using UnityEditor;
    #endif
    
    namespace AC
    {
    
        [System.Serializable]
        public class ActionApplyResolution : Action
        {
    
            public ActionApplyResolution()
            {
                this.isDisplayed = true;
                category = ActionCategory.Object;
                title = "Apply resolution";
            }
    
    
            override public float Run()
            {
                int chosenResolutionIndex = GlobalVariables.GetIntegerValue(9); // Replace '0' with your resolution variable's ID number
                if (chosenResolutionIndex >= 0)
                {
                    Resolution chosenResolution = Screen.resolutions[chosenResolutionIndex];
    
                    Screen.SetResolution(chosenResolution.width, chosenResolution.height, Screen.fullScreen);
                    KickStarter.playerMenus.RecalculateAll();
                }
    
                int qualityLevel = GlobalVariables.GetIntegerValue(13); // Replace '1' with your quality variable's ID number
                QualitySettings.SetQualityLevel(qualityLevel, true);
    
                bool isEnabled = GlobalVariables.GetBooleanValue(15); // Replace '0' with your own variable's ID number
                KickStarter.mainCamera.GetComponent<AuraCamera>().enabled = isEnabled;
                return 0f;
    
            }
    
        }
    
    }
    
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.