- Home /
Toggle threw Quality Settings with Keyboard key?
hey! so i know how i can change the quality settings during runtime:
public void IncreaseLevel () {
QualitySettings.IncreaseLevel(true);
}
public void DecreaseLevel () {
QualitySettings.DecreaseLevel(true);
}
but how can i do something like:
if (Input.GetKeyDown(KeyCode.Alpha7)){
QualitySettings.SetQualityLevel(next)
}
so that it goes back to quality level 1 when its at 6 and i press the AlphaKey7 again?
Answer by Eno-Khaon · Jul 04, 2016 at 05:19 PM
While there doesn't appear to be a predefined integer for the number of Quality Levels, that doesn't mean the quantity can't still be determined.
QualitySettings.names will provide an array containing the total number of Quality Levels, so that can be used to snag the total count. Actually cycling through them would be simple enough, however, since you're already doing much of that:
// C#
int qualityLevelCount;
void Start()
{
qualityLevelCount = QualitySettings.names.Length;
}
if(Input.GetKeyDown(KeyCode.Alpha7))
{
int currentLevel = QualitySettings.GetQualityLevel();
QualitySettings.SetQualityLevel((currentLevel + 1) % qualityLevelCount, true);
}
Your answer
Follow this Question
Related Questions
Textures looks very poor in unity than in Maya 0 Answers
Set AA Quality besides the other settings. 0 Answers
Quality setting popup not showing on build startup 1 Answer
Turn off a component through settings 1 Answer
quality settings 1 Answer