internal void SetBundledAssetGroupSchemaPaths(AddressableAssetSettings settings, ProfileValueReference pvr, string newVariableName, string oldVariableName, List <string> variableNames)
 {
     if (variableNames.Contains(newVariableName))
     {
         pvr.SetVariableByName(settings, newVariableName);
     }
     else if (variableNames.Contains(oldVariableName))
     {
         pvr.SetVariableByName(settings, oldVariableName);
     }
     else
     {
         Debug.LogWarning("Default path variable " + newVariableName + " not found when initializing BundledAssetGroupSchema. Please manually set the path via the groups window.");
     }
 }
        void DrawRemoteCatalogPaths()
        {
            ProfileValueReference BuildPath = m_AasTarget.RemoteCatalogBuildPath;
            ProfileValueReference LoadPath  = m_AasTarget.RemoteCatalogLoadPath;

            AddressableAssetSettings settings = AddressableAssetSettingsDefaultObject.Settings;

            if (settings == null)
            {
                return;
            }
            List <ProfileGroupType> groupTypes = ProfileGroupType.CreateGroupTypes(settings.profileSettings.GetProfile(settings.activeProfileId));
            List <string>           options    = groupTypes.Select(group => group.GroupTypePrefix).ToList();

            //set selected to custom
            options.Add(AddressableAssetProfileSettings.customEntryString);
            int?selected          = options.Count - 1;
            HashSet <string> vars = settings.profileSettings.GetAllVariableIds();

            if (vars.Contains(BuildPath.Id) && vars.Contains(LoadPath.Id) && !m_UseCustomPaths)
            {
                for (int i = 0; i < groupTypes.Count; i++)
                {
                    ProfileGroupType.GroupTypeVariable buildPathVar = groupTypes[i].GetVariableBySuffix("BuildPath");
                    ProfileGroupType.GroupTypeVariable loadPathVar  = groupTypes[i].GetVariableBySuffix("LoadPath");
                    if (BuildPath.GetName(settings) == groupTypes[i].GetName(buildPathVar) && LoadPath.GetName(settings) == groupTypes[i].GetName(loadPathVar))
                    {
                        selected = i;
                        break;
                    }
                }
            }

            if (selected.HasValue && selected != options.Count - 1)
            {
                m_UseCustomPaths = false;
            }
            else
            {
                m_UseCustomPaths = true;
            }

            EditorGUI.BeginChangeCheck();
            var newIndex = EditorGUILayout.Popup("Build & Load Paths", selected.HasValue ? selected.Value : options.Count - 1, options.ToArray());

            if (EditorGUI.EndChangeCheck() && newIndex != selected)
            {
                if (options[newIndex] != AddressableAssetProfileSettings.customEntryString)
                {
                    Undo.RecordObject(serializedObject.targetObject, serializedObject.targetObject.name + "Path Pair");
                    BuildPath.SetVariableByName(settings, groupTypes[newIndex].GroupTypePrefix + ProfileGroupType.k_PrefixSeparator + "BuildPath");
                    LoadPath.SetVariableByName(settings, groupTypes[newIndex].GroupTypePrefix + ProfileGroupType.k_PrefixSeparator + "LoadPath");
                    m_UseCustomPaths = false;
                }
                else
                {
                    Undo.RecordObject(serializedObject.targetObject, serializedObject.targetObject.name + "Path Pair");
                    m_UseCustomPaths = true;
                }
                EditorUtility.SetDirty(this);
            }

            if (m_UseCustomPaths)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_RemoteCatalogBuildPath"), m_RemoteCatBuildPath);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("m_RemoteCatalogLoadPath"), m_RemoteCatLoadPath);
            }

            EditorGUI.indentLevel++;
            m_ShowPaths = EditorGUILayout.Foldout(m_ShowPaths, "Path Preview", true);
            if (m_ShowPaths)
            {
                EditorStyles.helpBox.fontSize = 12;
                var baseBuildPathValue = settings.profileSettings.GetValueById(settings.activeProfileId, BuildPath.Id);
                var baseLoadPathValue  = settings.profileSettings.GetValueById(settings.activeProfileId, LoadPath.Id);
                EditorGUILayout.HelpBox(String.Format("Build Path: {0}", settings.profileSettings.EvaluateString(settings.activeProfileId, baseBuildPathValue)), MessageType.None);
                EditorGUILayout.HelpBox(String.Format("Load Path: {0}", settings.profileSettings.EvaluateString(settings.activeProfileId, baseLoadPathValue)), MessageType.None);
            }
            EditorGUI.indentLevel--;
        }