public IEnumerator TestNoPackageIdErrorsOut() { #if !UNITY_2020_2_OR_NEWER AdaptivePerformancePackageMetadataStore.InstallPackageAndAssignLoaderForBuildTarget("", String.Empty, BuildTargetGroup.Standalone); LogAssert.Expect(LogType.Error, new Regex(@"no package id")); while (AdaptivePerformancePackageMetadataStore.isDoingQueueProcessing) { yield return(null); } #else yield return(null); #endif //UNITY_2020_2_OR_NEWER }
internal bool OnGUI(BuildTargetGroup buildTargetGroup) { var settings = AdaptivePerformanceGeneralSettingsPerBuildTarget.AdaptivePerformanceGeneralSettingsForBuildTarget(buildTargetGroup); if (buildTargetGroup != CurrentBuildTargetGroup || m_LoaderMetadata == null) { CurrentBuildTargetGroup = buildTargetGroup; if (m_LoaderMetadata == null) { m_LoaderMetadata = new List <LoaderInformation>(); } else { m_LoaderMetadata.Clear(); } foreach (var pmd in AdaptivePerformancePackageMetadataStore.GetLoadersForBuildTarget(buildTargetGroup)) { m_LoaderMetadata.Add(new LoaderInformation() { packageName = pmd.packageName, packageId = pmd.packageId, loaderName = pmd.loaderName, loaderType = pmd.loaderType, licenseURL = pmd.licenseURL, toggled = AdaptivePerformancePackageMetadataStore.IsLoaderAssigned(pmd.loaderType, buildTargetGroup) }); } if (settings != null) { LoaderInformation li; for (int i = 0; i < m_LoaderMetadata.Count; i++) { li = m_LoaderMetadata[i]; if (AdaptivePerformancePackageMetadataStore.IsLoaderAssigned(settings.AssignedSettings, li.loaderType)) { li.toggled = true; m_LoaderMetadata[i] = li; break; } } } m_OrderedList = new ReorderableList(m_LoaderMetadata, typeof(LoaderInformation), false, true, false, false); m_OrderedList.drawHeaderCallback = (rect) => { var labelSize = EditorStyles.label.CalcSize(Content.k_LoaderUITitle); var labelRect = new Rect(rect); labelRect.width = labelSize.x; labelSize = EditorStyles.label.CalcSize(Content.k_HelpContent); var imageRect = new Rect(rect); imageRect.xMin = labelRect.xMax + 1; imageRect.width = labelSize.x; EditorGUI.LabelField(labelRect, Content.k_LoaderUITitle, EditorStyles.label); EditorGUI.LabelField(imageRect, Content.k_HelpContent); }; m_OrderedList.drawElementCallback = (rect, index, isActive, isFocused) => DrawElementCallback(rect, index, isActive, isFocused); m_OrderedList.elementHeightCallback = (index) => GetElementHeight(index); m_OrderedList.drawFooterCallback = (rect) => { var status = AdaptivePerformancePackageMetadataStore.GetCurrentStatusDisplayText(); GUI.Label(rect, status, EditorStyles.label); }; } if (m_LoaderMetadata == null || m_LoaderMetadata.Count == 0) { EditorGUILayout.HelpBox(Content.k_AtNoLoaderInstance, MessageType.Info); } else { EditorGUILayout.HelpBox(Content.k_LicenseText, MessageType.Info); EditorGUILayout.Space(); m_OrderedList.DoLayoutList(); if (settings != null) { LoaderInformation li; for (int i = 0; i < m_LoaderMetadata.Count; i++) { li = m_LoaderMetadata[i]; if (li.stateChanged) { if (li.toggled) { AdaptivePerformancePackageMetadataStore.InstallPackageAndAssignLoaderForBuildTarget(li.packageId, li.loaderType, buildTargetGroup); } else { AdaptivePerformancePackageMetadataStore.RemoveLoader(settings.AssignedSettings, li.loaderType, buildTargetGroup); } li.stateChanged = false; m_LoaderMetadata[i] = li; } } } } return(false); }