public static void PerformMigration(int migrateStart) { UpdateProgressBar(0); UnityEngine.Debug.Log("WwiseUnity: Migrating from Unity Integration Version " + migrateStart + " to " + AkUtilities.MigrationStopIndex); AkPluginActivator.DeactivateAllPlugins(); AkPluginActivator.Update(); AkPluginActivator.ActivatePluginsForEditor(); // Get the name of the currently opened scene. var activeScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene(); var loadedScenePath = activeScene.path; if (!string.IsNullOrEmpty(loadedScenePath)) { AkBasePathGetter.FixSlashes(ref loadedScenePath, '\\', '/', false); } UnityEditor.SceneManagement.EditorSceneManager.NewScene(UnityEditor.SceneManagement.NewSceneSetup.DefaultGameObjects); // obtain a list of ScriptableObjects before any migration is performed ScriptableObjectGuids = UnityEditor.AssetDatabase.FindAssets("t:ScriptableObject", new[] { "Assets" }); AkUtilities.BeginMigration(migrateStart); AkWwiseProjectInfo.GetData().Migrate(); AkWwiseWWUBuilder.UpdateWwiseObjectReferenceData(); MigratePrefabs(); MigrateScenes(); MigrateScriptableObjects(); UnityEditor.EditorUtility.UnloadUnusedAssetsImmediate(); UnityEditor.SceneManagement.EditorSceneManager.NewScene(UnityEditor.SceneManagement.NewSceneSetup.DefaultGameObjects); AkUtilities.EndMigration(); UpdateProgressBar(TotalNumberOfSections); // Reopen the scene that was opened before the migration process started. if (!string.IsNullOrEmpty(loadedScenePath)) { UnityEditor.SceneManagement.EditorSceneManager.OpenScene(loadedScenePath); } UnityEngine.Debug.Log("WwiseUnity: Removing lock for launcher."); // TODO: Moving one folder up is not nice at all. How to find the current project path? try { System.IO.File.Delete(UnityEngine.Application.dataPath + "/../.WwiseLauncherLockFile"); } catch (System.Exception) { // Ignore if not present. } UnityEditor.EditorUtility.ClearProgressBar(); }
public static void PerformMigration(int migrateStart, int migrateStop) { UpdateProgressBar(0f); UnityEngine.Debug.Log("WwiseUnity: Migrating incrementally to versions " + migrateStart + " up to " + migrateStop); AkPluginActivator.DeactivateAllPlugins(); AkPluginActivator.Update(); AkPluginActivator.ActivatePluginsForEditor(); // Get the name of the currently opened scene. var currentScene = AkSceneUtils.GetCurrentScene().Replace('/', '\\'); var wwiseComponentTypes = GetWwiseComponentTypes(); var sceneInfo = new System.IO.DirectoryInfo(UnityEngine.Application.dataPath).GetFiles("*.unity", System.IO.SearchOption.AllDirectories); AkSceneUtils.CreateNewScene(); AkUtilities.IsMigrating = true; AkWwiseProjectInfo.PopulateForMigration(); AkWwiseWWUBuilder.UpdateWwiseObjectReferenceData(); for (var i = 0; i < sceneInfo.Length; i++) { UpdateProgressBar((float)i / sceneInfo.Length); var scene = "Assets" + sceneInfo[i].FullName.Substring(UnityEngine.Application.dataPath.Length); UnityEngine.Debug.Log("WwiseUnity: Migrating scene " + scene); AkSceneUtils.OpenExistingScene(scene); MigrateCurrentScene(wwiseComponentTypes, migrateStart - 1, migrateStop - 1); AkWwiseWWUBuilder.PopulateWwiseObjectReferences(); AkSceneUtils.SaveCurrentScene(); } UpdateProgressBar(1.0f); AkSceneUtils.CreateNewScene(); AkUtilities.IsMigrating = false; // Reopen the scene that was opened before the migration process started. AkSceneUtils.OpenExistingScene(currentScene); UnityEngine.Debug.Log("WwiseUnity: Removing lock for launcher."); // TODO: Moving one folder up is not nice at all. How to find the current project path? try { System.IO.File.Delete(UnityEngine.Application.dataPath + "/../.WwiseLauncherLockFile"); } catch (System.Exception) { // Ignore if not present. } UnityEditor.EditorUtility.ClearProgressBar(); }