Quality settings script

Hi!

I was wondering how you increse and decrease the quality of your game thorugh some scripting.

Now I have 3 planes that I’m using for buttons (I’m working with a main menu).
I’m using a tag system to check what plane you’re pressing, and that works perfectly.

Note! The “color.green”, “color, blue” etc is there so I can check if it’s working!

So what I need is to select what quality setting I want to use by pressing the buttons.

The script:

var HoverSound: AudioClip;

function OnMouseEnter()
{
	renderer.material.color = Color.grey;
	AudioSource.PlayClipAtPoint(HoverSound, transform.position);

}

function OnMouseDown ()

{

	if (gameObject.tag == "Low") 
	{
		renderer.material.color = Color.green;
		AudioSource.PlayClipAtPoint(HoverSound, transform.position);
		
		//Quality script goes here!
		
	}
	if (gameObject.tag == "Medium") 
	{
		renderer.material.color = Color.blue;
		AudioSource.PlayClipAtPoint(HoverSound, transform.position);
		
		//Quality script goes here!
		
	}
	if (gameObject.tag == "High") 
	{
		renderer.material.color = Color.red;
		AudioSource.PlayClipAtPoint(HoverSound, transform.position);
		
		//Quality script goes here!
		
	}

}

function OnMouseExit()
{
	renderer.material.color = Color.white;

}

Does anyone knnow how to do it?

You can use
QualitySettings.SetQualityLevel(level);

There are 6 different levels (0 low - 5 fantastic). So it would be

if (gameObject.tag == "Low")
{
QualitySettings.SetQualityLevel(0);
AudioSource.PlayClipAtPoint(HoverSound, transform.position);
 
//Quality script goes here!
 
}
if (gameObject.tag == "Medium")
{
QualitySettings.SetQualityLevel(2); // or 3
AudioSource.PlayClipAtPoint(HoverSound, transform.position);
 
//Quality script goes here!
 
}
if (gameObject.tag == "High")
{
QualitySettings.SetQualityLevel(5);
AudioSource.PlayClipAtPoint(HoverSound, transform.position);
 
//Quality script goes here!
 
}