Every game needs an options screen, and players notice when it is missing or broken. This guide builds a complete Unity settings menu: a resolution dropdown, a fullscreen mode dropdown, quality levels, a VSync toggle, master volume through an Audio Mixer, and saving everything so it loads next launch. It uses TextMeshPro dropdowns and sliders, plain C# and PlayerPrefs.
What We Are Building
The menu has five controls:
- A Dropdown for resolution, filled from the monitor’s supported modes.
- A Dropdown for fullscreen mode (Fullscreen, Borderless, Windowed).
- A Dropdown for quality level, filled from your Quality settings.
- A Toggle for VSync.
- A Slider for volume, controlling an Audio Mixer group.
In the hierarchy, create a Canvas, add the controls with GameObject > UI (use the TextMeshPro versions of Dropdown), and put one script, SettingsMenu, on a parent object. If you do not have a menu to put this in yet, start with the main menu tutorial, or open it from the pause menu.
Resolution and Fullscreen
Screen.resolutions returns every mode the monitor supports. Each entry has a width, height and refresh rate. The list repeats the same width and height for each refresh rate, which makes a messy dropdown, so we filter it to one entry per size and keep the current one selected.
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class SettingsMenu : MonoBehaviour
{
[SerializeField] TMP_Dropdown resolutionDropdown;
[SerializeField] TMP_Dropdown fullscreenDropdown;
readonly List<Resolution> options = new List<Resolution>();
void Start()
{
BuildResolutionList();
BuildFullscreenList();
}
void BuildResolutionList()
{
options.Clear();
var labels = new List<string>();
int current = 0;
foreach (Resolution r in Screen.resolutions)
{
// skip duplicates that only differ by refresh rate
if (options.Count > 0 &&
options[options.Count - 1].width == r.width &&
options[options.Count - 1].height == r.height)
{
options[options.Count - 1] = r; // keep the highest refresh rate
continue;
}
options.Add(r);
}
for (int i = 0; i < options.Count; i++)
{
labels.Add(options[i].width + " x " + options[i].height);
if (options[i].width == Screen.width && options[i].height == Screen.height)
current = i;
}
resolutionDropdown.ClearOptions();
resolutionDropdown.AddOptions(labels);
resolutionDropdown.SetValueWithoutNotify(current);
}
void BuildFullscreenList()
{
fullscreenDropdown.ClearOptions();
fullscreenDropdown.AddOptions(new List<string> { "Fullscreen", "Borderless", "Windowed" });
fullscreenDropdown.SetValueWithoutNotify(ModeToIndex(Screen.fullScreenMode));
}
public void SetResolution(int index)
{
Resolution r = options[index];
Screen.SetResolution(r.width, r.height, Screen.fullScreenMode);
}
public void SetFullscreenMode(int index)
{
Screen.fullScreenMode = IndexToMode(index);
}
static FullScreenMode IndexToMode(int i)
{
switch (i)
{
case 0: return FullScreenMode.ExclusiveFullScreen;
case 1: return FullScreenMode.FullScreenWindow;
default: return FullScreenMode.Windowed;
}
}
static int ModeToIndex(FullScreenMode m)
{
switch (m)
{
case FullScreenMode.ExclusiveFullScreen: return 0;
case FullScreenMode.FullScreenWindow: return 1;
default: return 2;
}
}
}
A few details matter here. SetValueWithoutNotify sets the selected item without firing the dropdown’s change event, so building the list does not accidentally apply a resolution. FullScreenMode.FullScreenWindow is borderless fullscreen, and it is the safest default because it handles alt-tab well. Exclusive fullscreen and some modes are only available on Windows. On macOS and Linux, the options behave differently, so test on your target platforms.
None of this does anything in the editor’s Game view. The Game view window ignores Screen.SetResolution, so test in a build.
Quality Level and VSync
Quality levels are defined in Edit > Project Settings > Quality. Rename them to something players understand (Low, Medium, High) and make sure each level is assigned to the right platform. Then read them in code:
[SerializeField] TMP_Dropdown qualityDropdown;
[SerializeField] UnityEngine.UI.Toggle vsyncToggle;
void BuildQualityList()
{
qualityDropdown.ClearOptions();
qualityDropdown.AddOptions(new List<string>(QualitySettings.names));
qualityDropdown.SetValueWithoutNotify(QualitySettings.GetQualityLevel());
vsyncToggle.SetIsOnWithoutNotify(QualitySettings.vSyncCount > 0);
}
public void SetQuality(int index)
{
QualitySettings.SetQualityLevel(index);
}
public void SetVSync(bool on)
{
QualitySettings.vSyncCount = on ? 1 : 0;
}
Call BuildQualityList() from Start. With VSync off and no cap, a menu scene can run at hundreds of frames per second and make the GPU fan scream. If you turn VSync off, also set Application.targetFrameRate to something sensible.
One catch: changing the quality level resets VSync to whatever that level defines. Apply the VSync toggle after the quality change, which the loading code below does in the right order.
Volume Sliders and the Audio Mixer
The clean way to control volume is an Audio Mixer. Create one with Assets > Create > Audio Mixer, open it, and select the Master group. In the Inspector, right-click the Volume label and choose Expose ‘Volume (of Master)’ to script. Then in the Mixer’s Exposed Parameters list (top right), rename the parameter to MasterVolume.
The mixer works in decibels, from about -80 dB (silent) to 0 dB (full). A slider is linear, so a direct mapping sounds wrong: most of the audible change happens in the last 10% of the slider. Convert with a logarithm:
using UnityEngine.Audio;
[SerializeField] AudioMixer mixer;
[SerializeField] UnityEngine.UI.Slider volumeSlider;
public void SetVolume(float value)
{
// slider min should be 0.0001, never 0, or Log10 returns negative infinity
float db = Mathf.Log10(value) * 20f;
mixer.SetFloat("MasterVolume", db);
}
Set the slider’s Min Value to 0.0001 and Max Value to 1. A value of 0 would send Log10(0), which is negative infinity, and the mixer ignores it or glitches. Make separate groups for Music and SFX and expose a parameter for each if you want separate sliders. The audio manager guide shows how to route sounds through mixer groups.
Saving and Loading Settings
Settings are tiny and you read them at startup, which makes PlayerPrefs a good fit. For when to use it versus JSON, see the PlayerPrefs vs JSON comparison.
const string ResKey = "res";
const string FsKey = "fs";
const string QualityKey = "quality";
const string VsyncKey = "vsync";
const string VolumeKey = "volume";
public void Save()
{
PlayerPrefs.SetInt(ResKey, resolutionDropdown.value);
PlayerPrefs.SetInt(FsKey, fullscreenDropdown.value);
PlayerPrefs.SetInt(QualityKey, qualityDropdown.value);
PlayerPrefs.SetInt(VsyncKey, vsyncToggle.isOn ? 1 : 0);
PlayerPrefs.SetFloat(VolumeKey, volumeSlider.value);
PlayerPrefs.Save();
}
public void Load()
{
if (!PlayerPrefs.HasKey(QualityKey)) return; // first launch: keep defaults
int quality = PlayerPrefs.GetInt(QualityKey);
qualityDropdown.SetValueWithoutNotify(quality);
SetQuality(quality);
bool vsync = PlayerPrefs.GetInt(VsyncKey, 1) == 1;
vsyncToggle.SetIsOnWithoutNotify(vsync);
SetVSync(vsync);
int fs = PlayerPrefs.GetInt(FsKey, 1);
fullscreenDropdown.SetValueWithoutNotify(fs);
SetFullscreenMode(fs);
int res = Mathf.Clamp(PlayerPrefs.GetInt(ResKey, 0), 0, options.Count - 1);
resolutionDropdown.SetValueWithoutNotify(res);
SetResolution(res);
float vol = PlayerPrefs.GetFloat(VolumeKey, 1f);
volumeSlider.SetValueWithoutNotify(vol);
SetVolume(vol);
}
Call Load() at the end of Start(), after the dropdowns are filled. Two points: the resolution index depends on the list order, which can change if the player swaps monitors, so clamp it as shown or save the actual width and height instead. And the audio level should apply at game launch, not only when the menu opens. If the menu scene is not the first scene, move the load into a small bootstrap object that survives scene changes.
Wiring Up the UI
- Select the Resolution dropdown. In On Value Changed, click +, drag in the object with SettingsMenu, and choose
SettingsMenu.SetResolutionunder “Dynamic int”. - Do the same for the fullscreen dropdown (
SetFullscreenMode) and quality dropdown (SetQuality). - For the VSync Toggle, pick
SetVSyncunder “Dynamic bool”. - For the Slider, pick
SetVolumeunder “Dynamic float”. - Add a Back or Apply button that calls
Save.
Make sure the dynamic version of each method is selected. Picking the entry from the “Static Parameters” section passes a fixed value you typed in the Inspector instead of the live control value.
🔧 UI and audio tools
Polished menus and audio tools save a lot of time. See our recommended Asset Store tools for indie projects.
Troubleshooting
Resolution does not change in the editor
The Game view ignores Screen.SetResolution. Make a build and test there.
The slider does nothing to the volume
The mixer parameter is not exposed, or the name in code does not match. A failed SetFloat returns false, so log it: if (!mixer.SetFloat("MasterVolume", db)) Debug.LogWarning("MasterVolume is not exposed");. Also confirm your AudioSources output to a mixer group, not straight to the listener.
The volume is almost silent until the slider is at maximum
You are mapping the slider straight to decibels. Use Mathf.Log10(value) * 20.
The settings reset every launch
You never call Save, or Load runs before the controls exist. Save on Apply or when closing the menu and call Load after building the dropdowns.
The dropdown lists the same resolution many times
Screen.resolutions repeats each size per refresh rate. Filter duplicates as in the code above.
The dropdown text is missing or shows a placeholder
You are using the legacy Dropdown with a TMP script field, or the reverse. Create the dropdown from the TextMeshPro menu item and use TMP_Dropdown in code. See the TextMeshPro tutorial if you need to import the essentials.
FAQ
Should I use PlayerPrefs or a JSON file?
PlayerPrefs is fine for a few settings values. Use JSON for larger data or when you want players to be able to find and copy the file.
How do I add a Back button that does not save?
Store the values when the menu opens and restore them if the player cancels, or simply apply changes live and save on every change.
Can I add a revert-after-15-seconds prompt for resolution?
Yes. Remember the old resolution, apply the new one, and show a confirm dialog with a timer. If it expires, call SetResolution with the old values.
How do I set a default resolution on first launch?
Do nothing: Unity starts with the player’s last resolution. Use the Player Settings to set the default fullscreen mode and window size.
Does the settings menu work on mobile?
Quality and volume do. Resolution and fullscreen are desktop concepts, so hide those controls on mobile builds.
Reader questions
Asked by readers of this article and answered by AI. Behavior can differ between Unity versions, so test in yours.




Leave a Reply