public void OnPreprocessBuild(BuildReport report)
        {
            CheckInstalledProvider();

            // Always remember to clean up preloaded assets after build to make sure we don't
            // dirty later builds with assets that may not be needed or are out of date.
            CleanOldSettings();

            AdaptivePerformanceGeneralSettingsPerBuildTarget buildTargetSettings = null;

            EditorBuildSettings.TryGetConfigObject(AdaptivePerformanceGeneralSettings.k_SettingsKey, out buildTargetSettings);
            if (buildTargetSettings == null)
            {
                return;
            }

            AdaptivePerformanceGeneralSettings settings = buildTargetSettings.SettingsForBuildTarget(report.summary.platformGroup);

            if (settings == null)
            {
                return;
            }

            UnityEngine.Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets();

            if (!preloadedAssets.Contains(settings))
            {
                var assets = preloadedAssets.ToList();
                assets.Add(settings);
                PlayerSettings.SetPreloadedAssets(assets.ToArray());
            }
        }
        /// <summary>Given a build target, get the general settings container assigned to it.</summary>
        /// <param name="targetGroup">An enum that specifies which platform group this build is for.</param>
        /// <returns>The instance of <see cref="AdaptivePerformanceGeneralSettings"/> assigned to the key, or null if no instance is assigned.</returns>
        public static AdaptivePerformanceGeneralSettings AdaptivePerformanceGeneralSettingsForBuildTarget(BuildTargetGroup targetGroup)
        {
            AdaptivePerformanceGeneralSettingsPerBuildTarget buildTargetSettings = null;

            EditorBuildSettings.TryGetConfigObject(AdaptivePerformanceGeneralSettings.k_SettingsKey, out buildTargetSettings);
            if (buildTargetSettings == null)
            {
                return(null);
            }

            return(buildTargetSettings.SettingsForBuildTarget(targetGroup));
        }
        static void PlayModeStateChanged(PlayModeStateChange state)
        {
            AdaptivePerformanceGeneralSettingsPerBuildTarget buildTargetSettings = null;

            EditorBuildSettings.TryGetConfigObject(AdaptivePerformanceGeneralSettings.k_SettingsKey, out buildTargetSettings);
            if (buildTargetSettings == null)
            {
                return;
            }

            AdaptivePerformanceGeneralSettings instance = buildTargetSettings.SettingsForBuildTarget(BuildTargetGroup.Standalone);

            if (instance == null || !instance.InitManagerOnStart)
            {
                return;
            }

            instance.InternalPlayModeStateChanged(state);
        }