Change Game quality in-game

Hi everyone.

I’m using Unity 3.3 pro

I would like to make an option in my menu to change the resolution of the game, so you can choose; Fastest, Fast, Simple, Good, Beauthiful or Fantastic. I disabled the Auto input of Unity, because i want that option in my in-game. But how can i make that?

It works fine, make sure that you close OnGUI too and also spell “beautiful”.

Here’s the corrected script:

function OnGUI () {
	// Make a background box
	GUI.Box (Rect (10,10,200,1000), "Graphics Resolution");

	// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
	if (GUI.Button (Rect (20,40,80,20), "Fastest")) {
		QualitySettings.currentLevel = QualityLevel.Fastest;
	}

	// Make the second button.
	if (GUI.Button (Rect (20,70,80,20), "Fast")) {
		QualitySettings.currentLevel = QualityLevel.Fast;
	}

	// Make the second button.
	if (GUI.Button (Rect (20,100,80,20), "Simple")) {
		QualitySettings.currentLevel = QualityLevel.Simple;
	}

	// Make the second button.
	if (GUI.Button (Rect (20,130,80,20), "Good")) {
		QualitySettings.currentLevel = QualityLevel.Good;
	}

	// Make the second button.
	if (GUI.Button (Rect (20,160,80,20), "Beautiful")) {
		QualitySettings.currentLevel = QualityLevel.Beautiful;
	}

	// Make the second button.
	if (GUI.Button (Rect (20,190,80,20), "Fantastic")) {
		QualitySettings.currentLevel = QualityLevel.Fantastic;
	}
}

Use GUI functions (eg. HorizontalSlider), to get the user’s choice, then just set QualitySettings.currentLevel

To change Resolution, offer the user the options from Screen.resolutions that suit your game, then set the selected one using Screen.SetResolution

Sorry that i write this as an answer. But this is the script i have now. I don’t know what i did wrong.

function OnGUI () {

GUI.Box (Rect (10,10,200,1000), "Graphics Resolution");


if (GUI.Button (Rect (20,40,80,20), "Fastest")) {
	QualitySettings.currentLevel = QualityLevel.Fastest;
}

// Make the second button.
if (GUI.Button (Rect (20,70,80,20), "Fast")) {
	QualitySettings.currentLevel = QualityLevel.Fast;
}

// Make the second button.
if (GUI.Button (Rect (20,100,80,20), "Simple")) {
	QualitySettings.currentLevel = QualityLevel.Simple;
}

// Make the second button.
if (GUI.Button (Rect (20,130,80,20), "Good")) {
	QualitySettings.currentLevel = QualityLevel.Good;
}

// Make the second button.
if (GUI.Button (Rect (20,160,80,20), "Beauthiful")) {
	QualitySettings.currentLevel = QualityLevel.Beauthiful;
}

// Make the second button.
if (GUI.Button (Rect (20,190,80,20), "Fantastic")) {
	QualitySettings.currentLevel = QualityLevel.Fantastic;

}

Can someone help me?