Пример #1
0
    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 files =
            new System.IO.DirectoryInfo(UnityEngine.Application.dataPath + "/Wwise/Deployment/Components").GetFiles("*.cs",
                                                                                                                    System.IO.SearchOption.AllDirectories);
        var sceneInfo =
            new System.IO.DirectoryInfo(UnityEngine.Application.dataPath).GetFiles("*.unity",
                                                                                   System.IO.SearchOption.AllDirectories);
        var scenes = new string[sceneInfo.Length];

        AkSceneUtils.CreateNewScene();
        AkUtilities.IsMigrating = true;

        for (var i = 0; i < scenes.Length; i++)
        {
            UpdateProgressBar((float)i / scenes.Length);

            var scene = "Assets" + sceneInfo[i].FullName.Substring(UnityEngine.Application.dataPath.Length);
            UnityEngine.Debug.Log("WwiseUnity: Migrating scene " + scene);

            AkSceneUtils.OpenExistingScene(scene);
            MigrateCurrentScene(files, migrateStart - 1, migrateStop - 1);
            AkSceneUtils.SaveCurrentScene(null);
        }

        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();
    }
Пример #2
0
    public static void RunDemoSceneSetup()
    {
        try
        {
            UnityEngine.Debug.Log("WwiseUnity: Running demo scene setup...");

            AkSceneUtils.CreateNewScene();

            Setup();

            AkSceneUtils.OpenExistingScene("Assets/WwiseDemoScene/WwiseDemoScene.unity");

            UnityEngine.Debug.Log("WwiseUnity: Refreshing asset database.");
            UnityEditor.AssetDatabase.Refresh();

            UnityEngine.Debug.Log("WwiseUnity: End of demo scene setup, exiting Unity.");
        }
        catch (System.Exception e)
        {
            UnityEngine.Debug.LogError("WwiseUnity: Exception caught: " + e);
        }
    }
Пример #3
0
    private static void RunDemoSceneSetupImpl()
    {
        try
        {
            Debug.Log("WwiseUnity: Running demo scene setup...");

            AkSceneUtils.CreateNewScene();

            WwiseSetupWizard.Setup();

            AkSceneUtils.OpenExistingScene("Assets/WwiseDemoScene/WwiseDemoScene.unity");

            Debug.Log("WwiseUnity: Refreshing asset database.");
            AssetDatabase.Refresh();

            Debug.Log("WwiseUnity: End of demo scene setup, exiting Unity.");
            EditorApplication.Exit(0);
        }
        catch (Exception e)
        {
            Debug.LogError("WwiseUnity: Exception caught: " + e.ToString());
            EditorApplication.Exit(1);
        }
    }