private void Awake()
 {
     GpuWhitelist.EnsurePerformanceLevelFound();
 }
    protected override void InitializeInternal()
    {
        var performanceLevel = GpuWhitelist.EnsurePerformanceLevelFound();

        saves = SaveData.Load();
        if (saves.BucketIndex >= 0 && saves.BucketIndex < perfBucketList.Length)
        {
            currentBucket = saves.BucketIndex;
        }
        else if (performanceLevel != GpuWhitelist.SystemPerformanceLevel.Undefined)
        {
            switch (performanceLevel)
            {
            /// Add starting buckets based on the classification of the GPU you are running on
            /// Also feel free to adjust these and the whitelists lists based on what you find

            //case GpuWhitelist.SystemPerformanceLevel.HighEndUltra:
            //    currentBucket = startBucket + 1;
            //    break;
            //case GpuWhitelist.SystemPerformanceLevel.LowEndUltra:
            //    currentBucket = startBucket - 1;
            //    break;
            //case GpuWhitelist.SystemPerformanceLevel.Mainstream:
            //    currentBucket = startBucket - 2;
            //    break;
            case GpuWhitelist.SystemPerformanceLevel.Ultra:
            default:
                currentBucket = startBucket;
                break;
            }
        }
        else if (startBucket >= 0 && startBucket < perfBucketList.Length)
        {
            currentBucket = startBucket;
        }
        else
        {
            currentBucket = 0;
        }

        // if we're in the editor use the value from the inspector as default
        if (Application.isEditor)
        {
            currentBucket = startBucket;
        }

        // Ensure there is a Quality Manager
        if (QualityManager.Instance == null)
        {
            Debug.LogWarning("No QualityManager found by adaptive performance adding one");
            gameObject.AddComponent <QualityManager>();
        }

        // Ensure there is a Viewport Scale Manager
        if (ViewportScaleManager.Instance == null)
        {
            Debug.LogWarning("No ViewportScaleManager found by adaptive performance adding one");
            gameObject.AddComponent <ViewportScaleManager>();
        }

        // Ensure the performance counters are initialized
        if (PerformanceCounters.Instance == null)
        {
            Debug.LogWarning("No PerformanceCounters found by adaptive performance adding one");
            gameObject.AddComponent <PerformanceCounters>();
        }

        if (_adaptivePerformanceEnabled)
        {
            ApplyBucketSettings(currentBucket);
        }

        InitializeAnalyzer();
    }