- Home /
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?
Answer by save · Jul 02, 2011 at 01:02 PM
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;
}
}
Answer by Waz · Jul 02, 2011 at 12:19 PM
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, but I won't the HorizonSlider but i want Buttons.
The same basics still apply, create a couple of buttons and set different QualitySettings.currentLevel and Screen.SetResolution depending on which one gets pressed.
Very true Warwick, +1 on your answer as it probably were your answer who actually helped @Donilias in the first place.
Answer by Donilias · Jul 02, 2011 at 12:57 PM
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?
@coliam Actually it works even on the FPC lol, i tested it out so i integrated it into my project, just a modified version.
@Donilias "Sorry that i write this as an answer. But this is the script i have now. I don't know what i did wrong."
It would help to if you include the "Error" you receive, so people can help you better ;)
You spelled Beautiful wrong! You spelled it like Beauthiful!
Your answer
![](https://koobas.hobune.stream/wayback/20220612131436im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Can I customize the resolution window that appears at the start of my executable? 2 Answers
Changing screen resolution is cutting the very edge of my screen off 1 Answer
iPhone 4 and 5 resolution 1 Answer
How to use Float as Name in GameObject.Find command? 1 Answer
How to call Screen.SetResolution() only once before the first scene starts loading ? 1 Answer