Answer the question
In order to leave comments, you need to log in
How to implement graphics settings in Unity3d? via UI Button?
In the unit, I set 3 graphics levels Low, Normal, High and, accordingly, 3 UI Buttons.
Through the GUI it looks like this.
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void OnGUI() {
string[] names = QualitySettings.names;
GUILayout.BeginVertical();
int i = 0;
while (i < names.Length) {
if (GUILayout.Button(names[i]))
QualitySettings.SetQualityLevel(i, true);
i++;
}
GUILayout.EndVertical();
}
}
Answer the question
In order to leave comments, you need to log in
Button does not know how to call static methods, so to change graphics settings you need to write a wrapper:
using UnityEngine;
public class Test : MonoBehaviour
{
public void SetQualityLevel(int index)
{
QualitySettings.SetQualityLevel(index, true);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question