- Home /
controlling resolution and quality setting using UI Slider?
I want to control quality setting and resolution using unity 5's UI Slider .Now i can change those setting using buttons , tap 720p button to set resolution as 720p , tap 1080p button to set resolution as 1080p and tap low button to set quality setting as fastest and tap high button to set as fantastic but i want to control those setting using UI Slider, PLZ HELP
Answer by saschandroid · Aug 11, 2016 at 06:23 AM
Add a slider, set min and max value (for example 0-5 for 6 different quality levels), check 'whole numbers' and add a function that is called on value changed (dynamic float) like:
public void ChangeQuality(float level)
{
switch((int)level)
{
case 0:
// set values for quality level 0 here
break;
case 1:
// set values for quality level 1 here
break;
...
}
}
There is not much more code ... just insert the settings you want for the different level. For example:
case 0:
QualitySettings.SetQualityLevel(0); // For lowest quality
break;
You only have to put the script on a gameobject and then connect the slider (OnValueChanged) to the ChangeQuality function.
Your answer
Follow this Question
Related Questions
Trying to move slider based off percentage of screen 1 Answer
UI Slider looses control in Update function 1 Answer
Inverted scrollrect 1 Answer
Only Drag the slider by the handle 1 Answer
UI Slider, Save Values and Change Them 0 Answers