Search code examples
c#unity-game-engineuser-interfaceoptionmenu

How to make a standard Unity Options Menu?


I'm trying to find a standard assets in the assets store or something in the API that might let me create in less than a few hours a standard options menu with whatever Unity 5 provides. A prefab or something similar would be ideal.

So far I found that QualitySettings.names and a few others but nothing like a standard block for Audio and Keybindings that I can use right away.


Solution

  • Are you talking about creating an ingame menu / scene to control several options at runtime? It's pretty easy to write yourself, you already found the QualitySettings class and the the SetQualityLevel() function (Documentation). You can define your own additional quality levels (shadow quality, resolution, Vsync, Anti-Aliasing, Post-Effects etc.) in your project, but unity already has a few. For the audio part, we have the AudioSettings class (Documentation, Reset(config)), with which you can control a few things (AudioSpeakerMode, SampleRate, DspBuffer etc.). The overall volume can be controlled per scene in the audio manager (Documentation), but this is not runtime-scriptable. Instead, control the AudioListener component on your camera, you'd need to write some additional logic for that. The keybindings are controlled through Unity's input configuration and you get a window at startup, so that is already customizable. If you want to control that via script, have a look at this.