namespace UnityEngine.AdaptivePerformance
{
///
/// A scaler used by for adjusting at what distance LODs are switched.
///
public class AdaptiveLOD : AdaptivePerformanceScaler
{
float m_DefaultLodBias;
///
/// Ensures settings are applied during startup.
///
protected override void Awake()
{
base.Awake();
if (m_Settings == null)
return;
ApplyDefaultSetting(m_Settings.scalerSettings.AdaptiveLOD);
}
///
/// Callback when scaler gets disabled and removed from indexer
///
protected override void OnDisabled()
{
QualitySettings.lodBias = m_DefaultLodBias;
}
///
/// Callback when scaler gets enabled and added to the indexer
///
protected override void OnEnabled()
{
m_DefaultLodBias = QualitySettings.lodBias;
}
///
/// Callback for any level change.
///
protected override void OnLevel()
{
if (ScaleChanged())
QualitySettings.lodBias = m_DefaultLodBias * Scale;
}
}
}