- Home /
How do you make menu settings
Hi, so I've been trying to make a settings option for my game. I was a sensitivity option using sliders, audio sound, and brightness level. I have post processing enabled. So can you help me please.
Answer by MaKayla_Panda · Jun 20, 2019 at 03:02 AM
Hello! Here's a video that explains how to make a menu specifically used to change the setting in your game. Hope this helps!
https://www.youtube.com/watch?v=YOaYQrN1oYQ&list=PLPV2KyIb3jR4JsOygkHOd2q0CFoslwZOZ∈dex=2
currently my script looks like thin:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Audio; using UnityEngine.UI;
public class OptionsController : $$anonymous$$onoBehaviour {
public Audio$$anonymous$$ixer audio$$anonymous$$ixer;
public Dropdown resolutionDropdown;
Resolution[] resolutions;
void Start()
{
resolutions = Screen.resolutions;
resolutionDropdown.ClearOptions();
List<string> options = new List<string>();
int currentResolutionIndex = 0;
for (int i = 0; i < resolutions.Length; i++)
{
string option = resolutions[i].width + " x " + resolutions[i].height;
options.Add(option);
if (resolutions[i].Equals(Screen.currentResolution))
{
currentResolutionIndex = i;
}
}
resolutionDropdown.AddOptions(options);
resolutionDropdown.value = currentResolutionIndex;
resolutionDropdown.RefreshShownValue;
}
public void SetResolution(int resolutionIndex)
{
Resolution resolution = resolutions[resolutionIndex];
Screen.SetResolution(resolution.width, resolution.height, Screen.fullScreen);
}
public void SetVolume (float volume)
{
audio$$anonymous$$ixer.SetFloat("Volume", volume);
}
public void SetQuality (int qualityIndex)
{
QualitySettings.SetQualityLevel(qualityIndex);
}
public void SetFullscreen (bool isFullscreen)
{
Screen.fullScreen = isFullscreen;
}
}
and the "resolutionDropdown.RefreshShownValue;" is not working. I saw a comment by Patric H that solves the problem but I don't know what it should look like. Can you help me on this?
Your answer
Follow this Question
Related Questions
Recreate Unity Editor Window in Game 0 Answers
How to display an image above 3D object, 0 Answers
Script Two Button Functions At Once 1 Answer
3D arrangement of collection of gameobjects 0 Answers
Multiple Cars not working 1 Answer