public void OnUpdate() { if (EditorSettings.serializationMode != SerializationMode.ForceText) { EditorUtility.DisplayDialog("Unity Visual Scripting Upgrade", "We've detected an older version of Unity Visual Scripting (Bolt).\n\n" + "We can't migrate your project unless you use ForceText as your serialization mode. Go to Edit -> Project Settings -> Editor -> Asset Serialization -> Mode to set it.\n\nRe-initiate the migration by installing the package.", "OK / Uninstall"); Client.Remove("com.unity.visualscripting"); return; } var ok = EditorUtility.DisplayDialog("Unity Visual Scripting Upgrade", "We've detected an older version of Unity Visual Scripting (Bolt).\n\n" + "Your project and bolt assets will be backed up and migrated to work with the newest version. This can take a few minutes.", "Migrate My Project", "Cancel / Uninstall"); if (!ok) { Client.Remove("com.unity.visualscripting"); return; } VSBackupUtility.Backup(); // ClearLog(); foreach (var step in steps) { step.Reset(); step.Run(); if (step.state == MigrationStep.State.Failure) { Debug.LogWarning( $"VisualScripting - A migration step for {step.plugin.id} failed! Your project might be in an invalid state, restore your backup and try again..."); #if VISUAL_SCRIPT_DEBUG_MIGRATION throw step.exception; #endif } } Complete(); }
public void OnGUI() { GUILayout.Space(5f); GUILayout.Label(Title, EditorStyles.boldLabel); GUILayout.Space(5f); if (GUILayout.Button(ButtonBackupLabel, Styles.defaultsButton)) { VSBackupUtility.Backup(); EditorUtility.DisplayDialog("Backup", "Backup completed successfully.", "OK"); } if (GUILayout.Button(ButtonRestoreLabel, Styles.defaultsButton)) { PathUtility.CreateDirectoryIfNeeded(Paths.backups); Process.Start(Paths.backups); } }
public void OnGUI() { GUILayout.Space(5f); GUILayout.Label(title, EditorStyles.boldLabel); GUILayout.Space(5f); GUILayout.BeginVertical(); if (plugins.All(plugin => plugin.manifest.savedVersion == plugin.manifest.currentVersion)) { string label = "All your plugins are up to date."; GUILayout.BeginHorizontal(EditorStyles.helpBox); GUILayout.Label(EditorGUIUtility.IconContent("console.infoicon"), GUILayout.ExpandWidth(false)); GUILayout.Box(label, EditorStyles.wordWrappedLabel); GUILayout.EndHorizontal(); } GUILayout.Space(5f); DrawPluginVersionTable(plugins); GUILayout.Space(5f); if (plugins.Any(plugin => plugin.manifest.savedVersion != plugin.manifest.currentVersion)) { if (GUILayout.Button(buttonLabel, Styles.defaultsButton)) { VSBackupUtility.Backup(); (new VSMigrationUtility()).OnUpdate(); } } LudiqGUI.EndVertical(); }
private static void PerformUpdate() { VSBackupUtility.Backup(); (new VSMigrationUtility()).OnUpdate(); }
public void OnUpdate() { // If there are no migration steps required, don't bother the user if (steps.Count <= 0) { SetPluginVersionsToCurrent(); MigrationAnalytics.Send(analyticsData); return; } var firstVSPackageVersion = new SemanticVersion(1, 5, 0, "", 0); var olderVersionText = BoltCore.Manifest.savedVersion < firstVSPackageVersion ? "Unity Visual Scripting (Bolt)" : "Unity Visual Scripting"; if (EditorSettings.serializationMode != SerializationMode.ForceText) { EditorUtility.DisplayDialog("Unity Visual Scripting Upgrade", $"We've detected an older version of {olderVersionText}.\n\n" + "We can't migrate your project unless you use ForceText as your serialization mode. Go to Edit -> Project Settings -> Editor -> Asset Serialization -> Mode to set it.\n\n" + "Re-initiate the migration by installing the package.", "OK / Uninstall"); Client.Remove("com.unity.visualscripting"); return; } var ok = EditorUtility.DisplayDialog("Unity Visual Scripting Upgrade", $"We've detected an older version of {olderVersionText}.\n\n" + "Your project and bolt assets will be backed up and migrated to work with the newest version. This can take a few minutes.", "Migrate My Project", "Cancel / Uninstall"); if (!ok) { Client.Remove("com.unity.visualscripting"); return; } VSBackupUtility.Backup(); // ClearLog(); for (var i = 0; i < steps.Count; ++i) { var step = steps[i]; step.Reset(); step.Run(); if (step.state == MigrationStep.State.Failure) { Debug.LogWarning( $"VisualScripting - A migration step for {step.plugin.id} failed! Your project might be in an invalid state, restore your backup and try again..."); analyticsData.steps[i].success = false; analyticsData.steps[i].exception = AnalyticsUtilities.AnonymizeException(step.exception); analyticsData.total.success = false; break; #if VISUAL_SCRIPT_DEBUG_MIGRATION throw step.exception; #endif } else { analyticsData.steps[i].success = true; } } Complete(); }