Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Full options settings for a game

Discussion in 'Editor & General Support' started by Pytchoun, May 14, 2022.

  1. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    Hello,

    I am looking for a tutorial / example for the complete setting of options for a video game. I can only find basic examples which show just 2 options but nothing for all the full options on the possible parameter sets of a game.
    So I would like to be able to make a script that allows to modify all the options of a video game.

    Thanks.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,970
    Steps to success:

    - make a list of those options you consider "all the options"

    - decide on a UI presentation for each type

    - add them all into your UI one at a time.

    Remember: you are NOT going to work on them "all at the same time." That's not a thing. Solve each part of the overall problem one step at a time.
     
    DevDunk likes this.
  3. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    It's not a ui problem but a code problem.
    I'm looking for a tutorial that shows how to make the full options of a game.
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,970
    Options / settings / configuration stuff has the following parts:

    - a variable to store the state or value

    - a place to save it when the app isn't running (PlayerPrefs?)

    - a UI to adjust it through its normal range of values

    - code that looks at this value and changes behaviour accordingly.

    Which part are you stuck on?
     
  5. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    PlayerPrefs is the best to save it ?

    What are all the options available ? all is here https://docs.unity3d.com/ScriptReference/QualitySettings.html ?
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,970
    This is engineering. We make tradeoffs. Everything is "the best" in some context or other. If you're making a game jam with 1 setting, yeah, PlayerPrefs is absolutely best. If you are making something with 500 different options, perhaps some other type of persistence would be "the best."
     
  7. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    530
    No, not everything is there and a lot of stuff there is not relevant unless you have actually spent the effort to use those features in your game. There is no such thing as "all the options". Every time you use any Unity API or feature it could potentially be customized using an option, every time you add a new feature to your game it could potentially be controlled by option. A lot of stuff will vary between games because: not all the games use all the features of engine, implementing certain functionality is up to the game developer, certain features can be used in different ways and combinations, certain features can be implemented using different approaches, some features require extra packages and manual work to implement. Changing Unity QualitySettings will have no effect if you have your own custom implementation for corresponding graphics effect. Exposing settings for Unity features which you don't use will only make the players frustrated due to the options not doing the thing they claim and having to waste time searching for settings which actually work.

    If you have to ask question like this then most likely it will be a lot more valuable for the players if you implemented good: resolution and scaling settings, volume controls, input rebinding, accessibility, UI and gameplay settings. All of those are more or less dependent on the game with no single best or correct solution. Resolution and scaling behavior will depend on how flexible you made your UI (flexible UI is up to you), and the art style (nicely scaling pixel art is not the same as resizing window with 3d graphics), your chose of Camere components and how you use them, any nontrivial graphic pipeline and rendering passes for implementing special effects. Volume controls will depend on how complex sound system you setup and how finely you group your sound effects. Input rebinding will depend on how you read it (old input, new input, rewired, your own abstraction layer on top of any of the previous) does your game have local multiplayer modes, what kind of input devices does your game support? Stuff like hiding extra UI elements or finetuning UI size and positioning is up to you.

    Even if you consider only graphic quality settings a lot of stuff is up to developer. Unity can't know which parts which parts need higher resolutions textures more and which parts are less critical. It is up to you to create lower level 3d meshes and deciding which ones are fine to hide at distance. If you are writing fancy shaders it is up to you to write simplified versions of them and decide and when to use them.
     
    Ryiah and Kurt-Dekker like this.
  8. AnimalMan

    AnimalMan

    Joined:
    Apr 1, 2018
    Posts:
    1,164
    You know what I would put in my options

    windowed mode.

    maybe you’re thinking post processing effect control. As all of the options. Gamma. Contrast. Brightness, Volume, frame rate, wire frame. Motion blur, run in background. Time scale. Inverted mouse. Language. Colour blind, subtitles, antibaliassing, sound test
     
  9. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    I saw that it was wrong to use PlayerPrefabs, it writes to the windows registry, will never delete it and weigh it down.
     
  10. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,970
    Do you mean PlayerPrefs?

    If you want to use PlayerPrefs to save your game, it's always better to use a JSON-based wrapper such as this one I forked from a fellow named Brett M Johnson on github:

    https://gist.github.com/kurtdekker/7db0500da01c3eb2a7ac8040198ce7f6

    Then you can write that file wherever you like. Be sure you understand things like Application.persistentDataPath.
     
    Ryiah likes this.
  11. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    Yes PlayerPrefs
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I might suggest you prototype with PlayerPrefs since it's so easy to use. Wrap it in your own method. Once you have the logic working, then add your custom save logic if you need.
     
    Ryiah and Kurt-Dekker like this.
  13. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,189
    No. Creating a graphical settings system in Unity is a real pain as quality settings doesn't expose much of anything important. You have to do almost all of the work yourself by creating multiple render pipeline profiles, multiple post processing profiles, multiple LOD groups, etc and then write code that switches between them.
     
  14. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    You speak about URP?
     
  15. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,189
    Built-in, URP, and HDRP. What I mentioned above is applicable for all three minus render pipeline profiles which are URP and HDRP only. There is simply no easy way to build a graphical settings menu.
     
  16. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    Why you suggest to use JSON-based wrapper?
     
  17. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,970
    It was a direct response to your random musings here:

    Do you remember writing the above?
     
  18. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    Yes i know
     
  19. zero_one0101

    zero_one0101

    Joined:
    Jul 10, 2019
    Posts:
    5
    thank you for your answer . you answered one of them. if you could link a documentation page that has these unity APIs listed . it would help out a lot. thanks
     
  20. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,189
    I wish it were as simple as linking a page to people because then these threads would be easily solved but instead it's many pages covering many systems. I'm not a graphics programmer either so I don't know where most of them are.
     
    Last edited: Jan 22, 2023
    Kurt-Dekker likes this.