private static void GetCreateTileFromPaletteAttributeMethods() { m_CreateTileFromPaletteMethods = new List <MethodInfo>(); foreach (var sortingMethod in EditorAssemblies.GetAllMethodsWithAttribute <CreateTileFromPaletteAttribute>()) { m_CreateTileFromPaletteMethods.Add(sortingMethod); } }
public void ApplyActiveProfile() { m_ActiveProfile = new ShortcutProfile(k_UserProfileId); ApplyProfile(m_ActiveProfile); MigrateUserSpecifiedPrefKeys( EditorAssemblies.GetAllMethodsWithAttribute <FormerlyPrefKeyAsAttribute>(), m_Entries ); }
public static void CopyAvatarSceneAndBuildPlugin() { EditorPrefs.DeleteKey("pluginNamespace"); if (CustomScriptsAvailable()) { EditorAssemblies.AddOnAssemblyReloadCallback("CustomDLLMaker", "SwapScripts"); CreateNewSceneWithSelectedGameObject(); BuildAndLoadPlugin(); AssetDatabase.Refresh(); } }
public static void PrepareSceneForExport(string customNamespace = null) { EditorPrefs.DeleteKey("pluginNamespace"); if (CustomScriptsAvailable()) { CopyAndOpenCurrentScene(); BuildAndLoadPlugin(recompileCurrentPlugin: false, customNamespace); AssetDatabase.Refresh(); EditorAssemblies.AddOnAssemblyReloadCallback("CustomDLLMaker", "SwapScripts"); } }
internal static void InitializeBuildCallbacks() { buildPostProjectGeneratedProcessors = new List <IPostGenerateGradleAndroidProject>(); foreach (var type in EditorAssemblies.GetAllTypesWithInterface <IPostGenerateGradleAndroidProject>()) { if (type.IsAbstract || type.IsInterface) { continue; } buildPostProjectGeneratedProcessors.Add(Activator.CreateInstance(type) as IPostGenerateGradleAndroidProject); } buildPostProjectGeneratedProcessors.Sort(BuildPipelineInterfaces.CompareICallbackOrder); }
public static Type[] GetAllStandalonePlayableAssets() { IEnumerable <TrackType> arg_23_0 = TimelineHelpers.GetMixableTypes(); if (TimelineHelpers.< > f__mg$cache0 == null) { TimelineHelpers.< > f__mg$cache0 = new Func <TrackType, IEnumerable <Type> >(TimelineHelpers.GetTypesHandledByTrackType); } IEnumerable <Type> second = arg_23_0.SelectMany(TimelineHelpers.< > f__mg$cache0); IEnumerable <Type> first = from assemblyType in EditorAssemblies.get_loadedTypes() where typeof(IPlayableAsset).IsAssignableFrom(assemblyType) && typeof(ScriptableObject).IsAssignableFrom(assemblyType) && assemblyType.Assembly.FullName.Contains("Assembly-CSharp") select assemblyType; TimelineHelpers.s_StandaloneAssetTypes = first.Except(second).ToArray <Type>(); return(TimelineHelpers.s_StandaloneAssetTypes); }
public static TrackType[] GetMixableTypes() { TrackType[] result; if (TimelineHelpers.s_CachedMixableTypes != null) { result = TimelineHelpers.s_CachedMixableTypes; } else { TimelineHelpers.s_CachedMixableTypes = (from x in EditorAssemblies.get_loadedTypes() where !x.IsAbstract && typeof(TrackAsset).IsAssignableFrom(x) select x into t select new TrackType(t, TimelineHelpers.GetMediaTypeFromType(t))).ToArray <TrackType>(); result = TimelineHelpers.s_CachedMixableTypes; } return(result); }
// Given a track type, return all the playable asset types that should be // visible to the user via menus // Given a track type, return all the playable asset types public static Type GetCustomDrawer(Type trackType) { if (s_SubClassesOfTrackDrawer == null) { s_SubClassesOfTrackDrawer = EditorAssemblies.SubclassesOf(typeof(TrackDrawer)).ToList(); } foreach (var drawer in s_SubClassesOfTrackDrawer) { var attr = Attribute.GetCustomAttribute(drawer, typeof(CustomTrackDrawerAttribute), false) as CustomTrackDrawerAttribute; if (attr != null && attr.assetType.IsAssignableFrom(trackType)) { return(drawer); } } return(typeof(TrackDrawer)); }
public static void FinishExportCurrentSceneResourceWithPlugin() { try { ExportCurrentSceneResource(); if (!CustomDLLMaker.Cleanup()) { EditorAssemblies.AddOnAssemblyReloadCallback("CustomDLLMaker", "Cleanup"); EditorAssemblies.ReloadAssemblies(); } } catch (Exception ex) { Debug.LogError((object)(ex.ToString() + "\n" + ex.StackTrace)); throw ex; IL_0047 :; } }
public IEnumerable <IShortcutEntryDiscoveryInfo> GetDefinedShortcuts() { const BindingFlags staticMethodsBindings = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; var methods = EditorAssemblies.GetAllMethodsWithAttribute <ShortcutBaseAttribute>(staticMethodsBindings); var results = new List <IShortcutEntryDiscoveryInfo>(methods.Count()); foreach (var methodInfo in methods) { var attributes = (ShortcutBaseAttribute[])methodInfo.GetCustomAttributes(typeof(ShortcutBaseAttribute), true); foreach (var attribute in attributes) { var discoveredAttributeEntry = new ShortcutAttributeEntryInfo(methodInfo, attribute); results.Add(discoveredAttributeEntry); } } return(results); }
internal static void RegisterScriptedImporters() { var importers = EditorAssemblies.GetAllTypesWithAttribute <ScriptedImporterAttribute>(); foreach (var importer in importers) { var importerType = importer as Type; var attribute = Attribute.GetCustomAttribute(importerType, typeof(ScriptedImporterAttribute)) as ScriptedImporterAttribute; var handledExts = GetHandledExtensionsByImporter(attribute); // Prevent duplicates between importers! When duplicates found: all are rejected foreach (var imp in importers) { if (imp == importer) { continue; } var attribute2 = Attribute.GetCustomAttribute(imp as Type, typeof(ScriptedImporterAttribute)) as ScriptedImporterAttribute; var handledExts2 = GetHandledExtensionsByImporter(attribute2); // Remove intersection? foreach (var x1 in handledExts2) { if (handledExts.ContainsKey(x1.Key)) { // Log error message and remove from handledExts Debug.LogError(String.Format("Scripted importers {0} and {1} are targeting the {2} extension, rejecting both.", importerType.FullName, (imp as Type).FullName, x1.Key)); handledExts.Remove(x1.Key); } } } var supportsImportDependencyHinting = importerType.GetMethod("GetHashOfImportedAssetDependencyHintsForTesting", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) != null || importerType.GetMethod("GatherDependenciesFromSourceFile", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static) != null; // Register the importer foreach (var ext in handledExts) { AssetImporter.RegisterImporter(importerType, attribute.version, attribute.importQueuePriority, ext.Key, supportsImportDependencyHinting); } } }
public IEnumerable <ShortcutEntry> GetAllShortcuts() { var staticMethodsBindings = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; var methods = EditorAssemblies.GetAllMethodsWithAttribute <ShortcutAttribute>(staticMethodsBindings); var results = new List <ShortcutEntry>(methods.Count()); foreach (var methodInfo in methods) { var attributes = (ShortcutAttribute[])methodInfo.GetCustomAttributes(typeof(ShortcutAttribute), true); foreach (var attribute in attributes) { var shortcutEntry = ShortcutEntry.CreateFromAttribute(methodInfo, attribute); results.Add(shortcutEntry); } } return(results); }
public static Type GetCustomDrawer(Type trackType) { if (TimelineHelpers.s_SubClassesOfTrackDrawer == null) { TimelineHelpers.s_SubClassesOfTrackDrawer = EditorAssemblies.SubclassesOf(typeof(TrackDrawer)).ToList <Type>(); } Type result; foreach (Type current in TimelineHelpers.s_SubClassesOfTrackDrawer) { CustomTrackDrawerAttribute customTrackDrawerAttribute = Attribute.GetCustomAttribute(current, typeof(CustomTrackDrawerAttribute), false) as CustomTrackDrawerAttribute; if (customTrackDrawerAttribute != null && customTrackDrawerAttribute.assetType == trackType) { result = current; return(result); } } result = typeof(TrackDrawer); return(result); }
public static void ExportSceneResourceAndRun(string customNamespace = null) { try { if (ExportSceneResource(customNamespace)) { EditorAssemblies.AddOnAssemblyReloadCallback("VRC.AssetExporter", "RunExportedSceneResourceAndCleanupPlugin"); } else { AssetExporter.RunExportedSceneResourceAndCleanupPlugin(); } } catch (Exception ex) { AssetExporter.CleanupTmpFiles(); EditorAssemblies.ClearAssemblyReloadCallbacks(); throw ex; IL_0039 :; } }
public static Type GetDefaultBrushType() { Type defaultType = typeof(GridBrush); int count = 0; foreach (var type in EditorAssemblies.GetAllTypesWithAttribute <CustomGridBrushAttribute>()) { var attrs = type.GetCustomAttributes(typeof(CustomGridBrushAttribute), false) as CustomGridBrushAttribute[]; if (attrs != null && attrs.Length > 0) { if (attrs[0].defaultBrush) { defaultType = type; count++; } } } if (count > 1) { Debug.LogWarning("Multiple occurrences of defaultBrush == true found. It should only be declared once."); } return(defaultType); }
internal static void InitializeBuildCallbacks(BuildCallbacks findFlags) { if (findFlags == previousFlags) { return; } CleanupBuildCallbacks(); previousFlags = findFlags; bool findBuildProcessors = (findFlags & BuildCallbacks.BuildProcessors) == BuildCallbacks.BuildProcessors; bool findSceneProcessors = (findFlags & BuildCallbacks.SceneProcessors) == BuildCallbacks.SceneProcessors; bool findTargetProcessors = (findFlags & BuildCallbacks.BuildTargetProcessors) == BuildCallbacks.BuildTargetProcessors; bool findFilterProcessors = (findFlags & BuildCallbacks.FilterAssembliesProcessors) == BuildCallbacks.FilterAssembliesProcessors; bool findShaderProcessors = (findFlags & BuildCallbacks.ShaderProcessors) == BuildCallbacks.ShaderProcessors; var postProcessBuildAttributeParams = new Type[] { typeof(BuildTarget), typeof(string) }; foreach (var t in EditorAssemblies.GetAllTypesWithInterface <IOrderedCallback>()) { if (t.IsAbstract || t.IsInterface) { continue; } // Defer creating the instance until we actually add it to one of the lists object instance = null; if (findBuildProcessors) { AddToListIfTypeImplementsInterface(t, ref instance, ref processors.buildPreprocessors); AddToListIfTypeImplementsInterface(t, ref instance, ref processors.buildPreprocessorsWithReport); AddToListIfTypeImplementsInterface(t, ref instance, ref processors.buildPostprocessors); AddToListIfTypeImplementsInterface(t, ref instance, ref processors.buildPostprocessorsWithReport); } if (findSceneProcessors) { AddToListIfTypeImplementsInterface(t, ref instance, ref processors.sceneProcessors); AddToListIfTypeImplementsInterface(t, ref instance, ref processors.sceneProcessorsWithReport); } if (findTargetProcessors) { AddToListIfTypeImplementsInterface(t, ref instance, ref processors.buildTargetProcessors); } if (findFilterProcessors) { AddToListIfTypeImplementsInterface(t, ref instance, ref processors.filterBuildAssembliesProcessor); } if (findShaderProcessors) { AddToListIfTypeImplementsInterface(t, ref instance, ref processors.shaderProcessors); } } if (findBuildProcessors) { foreach (var m in EditorAssemblies.GetAllMethodsWithAttribute <Callbacks.PostProcessBuildAttribute>()) { if (ValidateMethod <Callbacks.PostProcessBuildAttribute>(m, postProcessBuildAttributeParams)) { AddToList(new AttributeCallbackWrapper(m), ref processors.buildPostprocessorsWithReport); } } } if (findSceneProcessors) { foreach (var m in EditorAssemblies.GetAllMethodsWithAttribute <Callbacks.PostProcessSceneAttribute>()) { if (ValidateMethod <Callbacks.PostProcessSceneAttribute>(m, Type.EmptyTypes)) { AddToList(new AttributeCallbackWrapper(m), ref processors.sceneProcessorsWithReport); } } } if (processors.buildPreprocessors != null) { processors.buildPreprocessors.Sort(CompareICallbackOrder); } if (processors.buildPreprocessorsWithReport != null) { processors.buildPreprocessorsWithReport.Sort(CompareICallbackOrder); } if (processors.buildPostprocessors != null) { processors.buildPostprocessors.Sort(CompareICallbackOrder); } if (processors.buildPostprocessorsWithReport != null) { processors.buildPostprocessorsWithReport.Sort(CompareICallbackOrder); } if (processors.buildTargetProcessors != null) { processors.buildTargetProcessors.Sort(CompareICallbackOrder); } if (processors.sceneProcessors != null) { processors.sceneProcessors.Sort(CompareICallbackOrder); } if (processors.sceneProcessorsWithReport != null) { processors.sceneProcessorsWithReport.Sort(CompareICallbackOrder); } if (processors.filterBuildAssembliesProcessor != null) { processors.filterBuildAssembliesProcessor.Sort(CompareICallbackOrder); } if (processors.shaderProcessors != null) { processors.shaderProcessors.Sort(CompareICallbackOrder); } }
protected static IEnumerable <Type> GetActionsOfType(Type actionType) { return(from type in EditorAssemblies.get_loadedTypes() where !type.IsGenericType && !type.IsNested && !type.IsAbstract && type.IsSubclassOf(actionType) select type); }
internal static void InitializeBuildCallbacks(BuildCallbacks findFlags) { if (findFlags == previousFlags) { return; } CleanupBuildCallbacks(); previousFlags = findFlags; bool findBuildProcessors = (findFlags & BuildCallbacks.BuildProcessors) == BuildCallbacks.BuildProcessors; bool findSceneProcessors = (findFlags & BuildCallbacks.SceneProcessors) == BuildCallbacks.SceneProcessors; bool findTargetProcessors = (findFlags & BuildCallbacks.BuildTargetProcessors) == BuildCallbacks.BuildTargetProcessors; var postProcessBuildAttributeParams = new Type[] { typeof(BuildTarget), typeof(string) }; foreach (var t in EditorAssemblies.GetAllTypesWithInterface <IOrderedCallback>()) { if (t.IsAbstract || t.IsInterface) { continue; } object instance = null; if (findBuildProcessors) { if (ValidateType <IPreprocessBuild>(t)) { AddToList(instance = Activator.CreateInstance(t), ref buildPreprocessors); } if (ValidateType <IPostprocessBuild>(t)) { AddToList(instance = instance == null ? Activator.CreateInstance(t) : instance, ref buildPostprocessors); } } if (findSceneProcessors && ValidateType <IProcessScene>(t)) { AddToList(instance = instance == null ? Activator.CreateInstance(t) : instance, ref sceneProcessors); } if (findTargetProcessors && ValidateType <IActiveBuildTargetChanged>(t)) { AddToList(instance = instance == null ? Activator.CreateInstance(t) : instance, ref buildTargetProcessors); } } if (findBuildProcessors) { foreach (var m in EditorAssemblies.GetAllMethodsWithAttribute <Callbacks.PostProcessBuildAttribute>()) { if (ValidateMethod <Callbacks.PostProcessBuildAttribute>(m, postProcessBuildAttributeParams)) { AddToList(new AttributeCallbackWrapper(m), ref buildPostprocessors); } } } if (findSceneProcessors) { foreach (var m in EditorAssemblies.GetAllMethodsWithAttribute <Callbacks.PostProcessSceneAttribute>()) { if (ValidateMethod <Callbacks.PostProcessSceneAttribute>(m, Type.EmptyTypes)) { AddToList(new AttributeCallbackWrapper(m), ref sceneProcessors); } } } if (buildPreprocessors != null) { buildPreprocessors.Sort(CompareICallbackOrder); } if (buildPostprocessors != null) { buildPostprocessors.Sort(CompareICallbackOrder); } if (buildTargetProcessors != null) { buildTargetProcessors.Sort(CompareICallbackOrder); } if (sceneProcessors != null) { sceneProcessors.Sort(CompareICallbackOrder); } }
private static void ExportCurrentSceneResourceWithPlugin(string customNamespace = null) { CustomDLLMaker.PrepareSceneForExport(customNamespace); EditorAssemblies.AddOnAssemblyReloadCallback("VRC.AssetExporter", "FinishExportCurrentSceneResourceWithPlugin"); }
internal static void InitializeBuildCallbacks(BuildPipelineInterfaces.BuildCallbacks findFlags) { if (findFlags != BuildPipelineInterfaces.previousFlags) { BuildPipelineInterfaces.previousFlags = findFlags; BuildPipelineInterfaces.CleanupBuildCallbacks(); bool flag = (findFlags & BuildPipelineInterfaces.BuildCallbacks.BuildProcessors) == BuildPipelineInterfaces.BuildCallbacks.BuildProcessors; bool flag2 = (findFlags & BuildPipelineInterfaces.BuildCallbacks.SceneProcessors) == BuildPipelineInterfaces.BuildCallbacks.SceneProcessors; bool flag3 = (findFlags & BuildPipelineInterfaces.BuildCallbacks.BuildTargetProcessors) == BuildPipelineInterfaces.BuildCallbacks.BuildTargetProcessors; Type[] expectedArguments = new Type[] { typeof(BuildTarget), typeof(string) }; foreach (Type current in EditorAssemblies.GetAllTypesWithInterface <IOrderedCallback>()) { if (!current.IsAbstract && !current.IsInterface) { object obj = null; if (flag) { if (BuildPipelineInterfaces.ValidateType <IPreprocessBuild>(current)) { BuildPipelineInterfaces.AddToList <IPreprocessBuild>(obj = Activator.CreateInstance(current), ref BuildPipelineInterfaces.buildPreprocessors); } if (BuildPipelineInterfaces.ValidateType <IPostprocessBuild>(current)) { BuildPipelineInterfaces.AddToList <IPostprocessBuild>(obj = ((obj != null) ? obj : Activator.CreateInstance(current)), ref BuildPipelineInterfaces.buildPostprocessors); } } if (flag2 && BuildPipelineInterfaces.ValidateType <IProcessScene>(current)) { BuildPipelineInterfaces.AddToList <IProcessScene>(obj = ((obj != null) ? obj : Activator.CreateInstance(current)), ref BuildPipelineInterfaces.sceneProcessors); } if (flag3 && BuildPipelineInterfaces.ValidateType <IActiveBuildTargetChanged>(current)) { BuildPipelineInterfaces.AddToList <IActiveBuildTargetChanged>((obj != null) ? obj : Activator.CreateInstance(current), ref BuildPipelineInterfaces.buildTargetProcessors); } } } if (flag) { foreach (MethodInfo current2 in EditorAssemblies.GetAllMethodsWithAttribute <PostProcessBuildAttribute>(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) { if (BuildPipelineInterfaces.ValidateMethod <PostProcessBuildAttribute>(current2, expectedArguments)) { BuildPipelineInterfaces.AddToList <IPostprocessBuild>(new BuildPipelineInterfaces.AttributeCallbackWrapper(current2), ref BuildPipelineInterfaces.buildPostprocessors); } } } if (flag2) { foreach (MethodInfo current3 in EditorAssemblies.GetAllMethodsWithAttribute <PostProcessSceneAttribute>(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)) { if (BuildPipelineInterfaces.ValidateMethod <PostProcessSceneAttribute>(current3, Type.EmptyTypes)) { BuildPipelineInterfaces.AddToList <IProcessScene>(new BuildPipelineInterfaces.AttributeCallbackWrapper(current3), ref BuildPipelineInterfaces.sceneProcessors); } } } if (BuildPipelineInterfaces.buildPreprocessors != null) { List <IPreprocessBuild> arg_263_0 = BuildPipelineInterfaces.buildPreprocessors; if (BuildPipelineInterfaces.< > f__mg$cache0 == null) { BuildPipelineInterfaces.< > f__mg$cache0 = new Comparison <IPreprocessBuild>(BuildPipelineInterfaces.CompareICallbackOrder); } arg_263_0.Sort(BuildPipelineInterfaces.< > f__mg$cache0); } if (BuildPipelineInterfaces.buildPostprocessors != null) { List <IPostprocessBuild> arg_294_0 = BuildPipelineInterfaces.buildPostprocessors; if (BuildPipelineInterfaces.< > f__mg$cache1 == null) { BuildPipelineInterfaces.< > f__mg$cache1 = new Comparison <IPostprocessBuild>(BuildPipelineInterfaces.CompareICallbackOrder); } arg_294_0.Sort(BuildPipelineInterfaces.< > f__mg$cache1); } if (BuildPipelineInterfaces.buildTargetProcessors != null) { List <IActiveBuildTargetChanged> arg_2C5_0 = BuildPipelineInterfaces.buildTargetProcessors; if (BuildPipelineInterfaces.< > f__mg$cache2 == null) { BuildPipelineInterfaces.< > f__mg$cache2 = new Comparison <IActiveBuildTargetChanged>(BuildPipelineInterfaces.CompareICallbackOrder); } arg_2C5_0.Sort(BuildPipelineInterfaces.< > f__mg$cache2); } if (BuildPipelineInterfaces.sceneProcessors != null) { List <IProcessScene> arg_2F6_0 = BuildPipelineInterfaces.sceneProcessors; if (BuildPipelineInterfaces.< > f__mg$cache3 == null) { BuildPipelineInterfaces.< > f__mg$cache3 = new Comparison <IProcessScene>(BuildPipelineInterfaces.CompareICallbackOrder); } arg_2F6_0.Sort(BuildPipelineInterfaces.< > f__mg$cache3); } } }
void MigrateUserSpecifiedPrefKeys() { // If migration already happened then don't do anything if (EditorPrefs.GetBool(k_ProfileMigratedEditorPrefKey, false)) { return; } EditorPrefs.SetBool(k_ProfileMigratedEditorPrefKey, true); // Find shortcut entries that might need to be migrated var allShortcuts = new List <ShortcutEntry>(); directory.GetAllShortcuts(allShortcuts); // Find existing or create migrated profile and make it active so we can amend it var originalActiveProfile = profileManager.activeProfile; var migratedProfile = profileManager.GetProfileById(k_MigratedProfileId); var migratedProfileAlreadyExisted = migratedProfile != null; if (!migratedProfileAlreadyExisted) { migratedProfile = profileManager.CreateProfile(k_MigratedProfileId); } profileManager.activeProfile = migratedProfile; var migratedProfileModified = false; var tempKeyCombinations = new KeyCombination[1]; var methodsWithFormerlyPrefKeyAs = EditorAssemblies.GetAllMethodsWithAttribute <FormerlyPrefKeyAsAttribute>(); foreach (var method in methodsWithFormerlyPrefKeyAs) { var shortcutAttr = Attribute.GetCustomAttribute(method, typeof(ShortcutAttribute), true) as ShortcutAttribute; if (shortcutAttr == null) { continue; } var entry = allShortcuts.Find(e => string.Equals(e.identifier.path, shortcutAttr.identifier)); if (entry == null) { continue; } // Ignore former PrefKey if it is overriden in existing migrated profile if (entry.overridden) { continue; } // Parse default pref key value from FormerlyPrefKeyAs attribute var prefKeyAttr = (FormerlyPrefKeyAsAttribute)Attribute.GetCustomAttribute(method, typeof(FormerlyPrefKeyAsAttribute)); var editorPrefDefaultValue = $"{prefKeyAttr.name};{prefKeyAttr.defaultValue}"; string name; Event keyboardEvent; string shortcut; if (!TryParseUniquePrefKeyString(editorPrefDefaultValue, out name, out keyboardEvent, out shortcut)) { continue; } var prefKeyDefaultKeyCombination = KeyCombination.FromPrefKeyKeyboardEvent(keyboardEvent); // Parse current pref key value (falling back on default pref key value) if (!TryParseUniquePrefKeyString(EditorPrefs.GetString(prefKeyAttr.name, editorPrefDefaultValue), out name, out keyboardEvent, out shortcut)) { continue; } var prefKeyCurrentKeyCombination = KeyCombination.FromPrefKeyKeyboardEvent(keyboardEvent); // Only migrate pref keys that the user actually overwrote if (prefKeyCurrentKeyCombination.Equals(prefKeyDefaultKeyCombination)) { continue; } string invalidBindingMessage; tempKeyCombinations[0] = prefKeyCurrentKeyCombination; if (!bindingValidator.IsBindingValid(tempKeyCombinations, out invalidBindingMessage)) { Debug.LogWarning($"Could not migrate existing binding for shortcut \"{entry.identifier.path}\" with invalid binding.\n{invalidBindingMessage}."); continue; } profileManager.ModifyShortcutEntry(entry.identifier, new List <KeyCombination> { prefKeyCurrentKeyCombination }); migratedProfileModified = true; } // Delete migrated profile if it was created and not modified if (!migratedProfileAlreadyExisted && !migratedProfileModified) { profileManager.DeleteProfile(migratedProfile); } // Restore original active profile unless last loaded profile was null and the migrated profile was created if (originalActiveProfile != null || migratedProfileAlreadyExisted) { profileManager.activeProfile = originalActiveProfile; } }