值 | 如果当前质量级别正在更改,则会触发此回调。 |
您可以使用此委托在 Unity 更改当前质量级别时调用自定义代码。
参数是之前的质量级别和新的质量级别。
using UnityEngine;
public class ExampleClass : MonoBehaviour { void Start() { QualitySettings.activeQualityLevelChanged += QualitySettings_activeQualityLevelChanged; }
private void QualitySettings_activeQualityLevelChanged(int previousQuality, int currentQuality) { // Put the code that you want to execute everytime the Quality used is changed Debug.Log($"Quality Level has been changed from {QualitySettings.names[previousQuality]} to {QualitySettings.names[currentQuality]}"); }
void OnDestroy() { QualitySettings.activeQualityLevelChanged -= QualitySettings_activeQualityLevelChanged; } }