Changing UI Text to the Quality Level

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)

I don’t know why the error but you can do it different:

59447-capture-2015-12-06-17-56-10-90.png

The Dynamic Pixels Per Unit sets the Quality for UI so you just got to have a variable to the Canvas Scaler and use CanvasScaler.dynamicPixelsPerUnit to change it

!WARNING! dont put it higher than 5, Lets just say that its not worth it