internal bool OnGUI(BuildTargetGroup buildTargetGroup) { var settings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(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 XRPackageMetadataStore.GetLoadersForBuildTarget(buildTargetGroup)) { m_LoaderMetadata.Add(new LoaderInformation() { packageName = pmd.packageName, packageId = pmd.packageId, loaderName = pmd.loaderName, loaderType = pmd.loaderType, toggled = XRPackageMetadataStore.IsLoaderAssigned(pmd.loaderType, buildTargetGroup) }); } if (settings != null) { LoaderInformation li; for (int i = 0; i < m_LoaderMetadata.Count; i++) { li = m_LoaderMetadata[i]; if (XRPackageMetadataStore.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) => GUI.Label(rect, EditorGUIUtility.TrTextContent("Plug-in Providers"), EditorStyles.label); m_OrderedList.drawElementCallback = (rect, index, isActive, isFocused) => DrawElementCallback(rect, index, isActive, isFocused); m_OrderedList.elementHeightCallback = (index) => GetElementHeight(index); } if (m_LoaderMetadata == null || m_LoaderMetadata.Count == 0) { EditorGUILayout.HelpBox(k_AtNoLoaderInstance, MessageType.Info); } else { 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) { if (XRPackageMetadataStore.IsPackageInstalled(li.packageId)) { XRPackageMetadataStore.AssignLoader(settings.AssignedSettings, li.loaderType, buildTargetGroup); } else { XRPackageMetadataStore.InstallPackageAndAssignLoaderForBuildTarget(li.packageId, li.loaderType, buildTargetGroup); } } else { XRPackageMetadataStore.RemoveLoader(settings.AssignedSettings, li.loaderType, buildTargetGroup); } li.stateChanged = false; m_LoaderMetadata[i] = li; } } } } return(false); }