Hey Guys,
I wanted to make a main menu and have the quality settings work by pushing a button and changing the quality level up or down. I manage to work the changing of quality level but I cannot figure out how to make the text change to the Quality level. Here is my script:
import UnityEngine.UI;
var qualityText : Transform;
var qualityLevel = QualitySettings.GetQualityLevel ();
function Start(){
}
function Update () {
qualityText.text = "" + qualityLevel;
}
function Increase()
{
QualitySettings.IncreaseLevel(true);
}
function Decrease()
{
QualitySettings.DecreaseLevel(true);
}
And here are the errors:
GetQualityLevel can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
ArgumentException: GetQualityLevel can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
QualityManager..ctor () (at Assets/EasyMenu/Resources/Scripts/QualityManager.js:4)