- Home /
Simple for loop to change QualityLevel
Hi unity community...
Ok so i'm trying to make a GUI than changes the Quality level of the game or project when click and displaying that value.
var qualityLevel = QualitySettings.GetQualityLevel();
function Update(){
guiText.text = "Display : " + qualityLevel;
}
function OnGUI(){
var i : int = 0;
for(i=1; i=6; i++);
QualitySettings.SetQualityLevel(i,true);
}
enter code here
For some reason i keep getting "Expecting =" on the for line.
So any insight to what could be the problem ?
~Wentzel
im sorry to say this; but if u have tried at least , you need not wait for a day on such a simple problem?!
Answer by Myhijim · Jul 05, 2012 at 12:04 PM
The for loops always need to be a ">", "<", ">=" or "<=", for some reason unknown to me.
So as stated by flamy, it must be
for(var i=0;i<=6;i++)
{
QualitySettings.SetQualityLevel(i,true);
}
~ Myhijim
No for loops can also be "==" and "!=" the problem with the code posted is that it is a single "=" which is an assignment not a comparison.
Your answer
![](https://koobas.hobune.stream/wayback/20220613073706im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Issue with OnTriggerEnter. 1 Answer
Player not taking any damage 2 Answers
Making a pick up item that is timed, that moves,scales and rotates 1 Answer
Get the number of items for loop returns 1 Answer
Why am I getting this error repeatedly? 2 Answers