Search Unity

QualitySettings.SetQualityLevel and custom changes

Discussion in 'Editor & General Support' started by Andefob, Jul 19, 2020.

  1. Andefob

    Andefob

    Joined:
    Sep 17, 2018
    Posts:
    99
    I was thinking about implementing graphics settings in a game so that players can set the quality level but also override individual settings. Setting the quality level would also reset all lower level settings. But it seems that if any of the lower-level settings have been changed, setting the quality level does not reset the value to the original value but to the new overridden value (if that level was on when the changes was made) until the game is restarted.

    Basically, I would need a way to call SetQualityLevel so that it ignores all lower level changes made so far and sets all settings as they originally were in the given quality level. Is there any easy way to do this? Or how would you implement "reset to defaults" functionality while also supporting changing individual values?
     
    Geurtsy11 likes this.
  2. I'm not sure I fully understand your question, so I am somewhat guessing.
    In general it is a very bad idea to keep manual the changes when you switch to a new Quality Level. You set up the actual settings in a given quality level for a reason. At least you should.

    On that note, you can save the manual settings by hand and you can reapply them after level change. There is no official support for this (AFAIK) because it is a bad idea.
     
  3. Andefob

    Andefob

    Joined:
    Sep 17, 2018
    Posts:
    99
    Many PC games give lots of fine-grained control over graphics settings these days and many players appreciate that. What I want is that players can tweak those values, but still press a button to get back the defaults if they wish to - and ideally so that there are different default quality levels as defined in QualitySettings currently. As I tried to explain, it seems that the current QualitySettings implementation does not support this since SetQualityLevel does not go back to the original values.

    Is it really so that the only way to achieve this is to basically re-implement QualitySettings, making a new system that can save and load every individual setting, ignoring quality levels? That is not nice since it feels like reinventing the wheel or a feature that should be there already - especially as Unity Player seems to automatically save and set quality settings to registry on PC so getting completely rid of it is not convenient. There must be some other PC games using Unity who are offering the same kind of functionality? Or is everyone just relying on the baked quality levels?
     
    Geurtsy11 likes this.
  4. DavidBVal

    DavidBVal

    Joined:
    Mar 13, 2017
    Posts:
    206

    I am not sure if you still have this issue, I am in the same boat.

    I am unsure if there's a better solution, but I am contemplating creating a new QualityLevel called "custom", and assign to it manually all the values from the "original" preset, and then apply the altered field. Sounds terrible but can't think of anything else.
     
  5. Andefob

    Andefob

    Joined:
    Sep 17, 2018
    Posts:
    99
    No solutions for me on this either. I just moved on to different things on the project and will get back to this later.

    I still wonder how other Unity games that are serious about PC do this. Things would be so much easier if setting built-in presets would actually use the original values, not taking into account run-time changes. I don't think it would be a big thing for Unity to add that as an optional parameter to QualitySettings.
     
  6. ThySpektre

    ThySpektre

    Joined:
    Mar 15, 2016
    Posts:
    362
    Just ran into the same issue today.
     
  7. DavidBVal

    DavidBVal

    Joined:
    Mar 13, 2017
    Posts:
    206
    Well, I gave up and now I manually assign all the values instead of using built-in quality levels. Wasted some time on this but works fine.
     
  8. misa67

    misa67

    Joined:
    Aug 17, 2018
    Posts:
    5
    Indeed odd behavior, wasted so many hours on something that should work out of the box as expected, like so many other Unity stuff but you learn to live with it :) Shame really, mixing manual assign of graphic property and "easy" in-game SetQualityLevel not working...
     
    Geurtsy11 likes this.
  9. Geurtsy11

    Geurtsy11

    Joined:
    Dec 6, 2020
    Posts:
    2
    Any solution to this?
     
  10. Andefob

    Andefob

    Joined:
    Sep 17, 2018
    Posts:
    99
    I never found any other solution except rewriting it all by myself. I just call SetQualityLevel once in the beginning with the highest settings and then do all other changes manually. Took me about 1000 lines of code plus the menu code.

    Have fun, it is the Unity way!
     
  11. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    We have same problem, we locked changing quality setting and I unlock it when there is "Custom" preset. so basically player cant change any preset, but it is not perfect