internal static void BeginPackageInitialization() { EditorApplication.update -= BeginPackageInitialization; foreach (var t in TypeLoaderExtensions.GetAllTypesWithInterface <IAdaptivePerformancePackage>()) { if (t.IsInterface || t.FullName.Contains("Unity.AdaptivePerformance.TestPackage") || t.FullName.Contains("UnityEditor.AdaptivePerformance.Editor.Metadata.AdaptivePerformanceKnownPackages")) { continue; } IAdaptivePerformancePackage package = Activator.CreateInstance(t) as IAdaptivePerformancePackage; if (package == null) { Debug.LogError($"Unable to find an implementation for expected package type {t.FullName}."); continue; } InitPackage(package); } foreach (var t in TypeLoaderExtensions.GetAllTypesWithInterface <AdaptivePerformancePackageInitializationBase>()) { if (t.IsInterface) { continue; } AdaptivePerformancePackageInitializationBase packageInit = Activator.CreateInstance(t) as AdaptivePerformancePackageInitializationBase; if (packageInit == null) { Debug.LogError($"Unable to find an implementation for expected package type {t.FullName}."); continue; } InitPackage(packageInit); } if (AdaptivePerformanceSettingsManager.Instance != null) { AdaptivePerformanceSettingsManager.Instance.ResetUi = true; } }
internal static void GetAllKnownLoaderInfos(List <AdaptivePerformanceLoaderInfo> newInfos) { var loaderTypes = TypeLoaderExtensions.GetAllTypesWithInterface <AdaptivePerformanceLoader>(); foreach (Type loaderType in loaderTypes) { if (loaderType.IsAbstract) { continue; } if (s_LoaderblockList.Contains(loaderType.Name)) { continue; } var assets = AssetDatabase.FindAssets(String.Format("t:{0}", loaderType)); if (!assets.Any()) { AdaptivePerformanceLoaderInfo info = new AdaptivePerformanceLoaderInfo(); info.loaderType = loaderType; newInfos.Add(info); } else { foreach (var asset in assets) { string path = AssetDatabase.GUIDToAssetPath(asset); AdaptivePerformanceLoaderInfo info = new AdaptivePerformanceLoaderInfo(); info.loaderType = loaderType; info.instance = AssetDatabase.LoadAssetAtPath(path, loaderType) as AdaptivePerformanceLoader; info.assetName = Path.GetFileNameWithoutExtension(path); newInfos.Add(info); } } } }
static SettingsProvider[] CreateAllChildSettingsProviders() { List <SettingsProvider> ret = new List <SettingsProvider>(); if (s_SettingsManager != null) { var ats = TypeLoaderExtensions.GetAllTypesWithAttribute <AdaptivePerformanceConfigurationDataAttribute>(); foreach (var at in ats) { if (at.FullName.Contains("Unity.AdaptivePerformance.TestPackage")) { continue; } AdaptivePerformanceConfigurationDataAttribute apbda = at.GetCustomAttributes(typeof(AdaptivePerformanceConfigurationDataAttribute), true)[0] as AdaptivePerformanceConfigurationDataAttribute; string settingsPath = String.Format("{1}/{0}", apbda.displayName, s_SettingsRootTitle); var resProv = new AdaptivePerformanceConfigurationProvider(settingsPath, apbda.buildSettingsKey, at); ret.Add(resProv); } } return(ret.ToArray()); }