QualitySettings.SetQualityLevel 设置质量级别
public static void QualitySettings.SetQualityLevel(int index)
public static void SetQualityLevel(int index, [DefaultValue("true")] bool applyExpensiveChanges);
Description 描述
Sets a new graphics quality level.
设置新的图形质量级别。
Note that changing the quality level can be an expensive operation if the new level has different anti-aliasing setting. It's fine to change the level when applying in-game quality options, but if you want to dynamically adjustquality level at runtime, pass false to applyExpensiveChanges so that expensive changes are not always applied.
注意改变质量级别可能是个昂贵的操作,如果新级别有不同的抗锯齿设置。当应用游戏质量选项可以很好改变该级别,但是如果你想在运行时动态调整级别,通过applyExpensiveChanges 设置为false,这样昂贵的变化并不总是被应用。
When building a player quality levels that are not used for that platform are stripped. You should not expect a given quality setting to be at a given index. It's best to query the available quality settings and use the returned index.
建立的玩家质量级别是不被抛离平台的。你不应该期待指定质量设置在指定索引中。它最好查询可获取质量设置并使用返回索引。
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(); } }