ActivatePlugins() public static method

public static ActivatePlugins ( string configToActivate, bool Activate ) : void
configToActivate string
Activate bool
return void
Ejemplo n.º 1
0
    public static void PerformMigration(int migrateStart, int migrateStop)
    {
        UpdateProgressBar(0f);

        Debug.Log("WwiseUnity: Migrating incrementally to versions " + migrateStart.ToString() + " up to " + migrateStop.ToString());

        AkPluginActivator.DeactivateAllPlugins();
        AkPluginActivator.Update();
        AkPluginActivator.ActivatePlugins(AkPluginActivator.CONFIG_PROFILE, true);

        // Get the name of the currently opened scene.
        string currentScene = AkSceneUtils.GetCurrentScene().Replace('/', '\\');

        FileInfo[] files = new DirectoryInfo(Application.dataPath + "/Wwise/Deployment/Components").GetFiles("*.cs", SearchOption.AllDirectories);

        FileInfo[] sceneInfo = new DirectoryInfo(Application.dataPath).GetFiles("*.unity", SearchOption.AllDirectories);
        string[]   scenes    = new string[sceneInfo.Length];

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

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

            string scene = "Assets" + sceneInfo[i].FullName.Substring(Application.dataPath.Length);
            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);

        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
        {
            File.Delete(Application.dataPath + "/../.WwiseLauncherLockFile");
        }
        catch (Exception)
        {
            // Ignore if not present.
        }

        EditorUtility.ClearProgressBar();
    }
Ejemplo n.º 2
0
    public static void ModifySetup()
    {
        string currentConfig = AkPluginActivator.GetCurrentConfig();

        if (String.IsNullOrEmpty(currentConfig))
        {
            currentConfig = AkPluginActivator.CONFIG_PROFILE;
        }

        AkPluginActivator.DeactivateAllPlugins();
        AkPluginActivator.Update();
        AkPluginActivator.ActivatePlugins(currentConfig, true);
    }
Ejemplo n.º 3
0
    // Perform all necessary steps to use the Wwise Unity integration.
    private static void Setup()
    {
        AkPluginActivator.DeactivateAllPlugins();

        // 0. Make sure the soundbank directory exists
        string sbPath = AkUtilities.GetFullPath(Application.streamingAssetsPath, Settings.SoundbankPath);

        if (!Directory.Exists(sbPath))
        {
            Directory.CreateDirectory(sbPath);
        }

        // 1. Disable built-in audio
        if (!DisableBuiltInAudio())
        {
            Debug.LogWarning("WwiseUnity: Could not disable built-in audio. Please disable built-in audio by going to Project->Project Settings->Audio, and check \"Disable Audio\".");
        }

        // 2. Create a "WwiseGlobal" game object and set the AkSoundEngineInitializer and terminator scripts
        // 3. Set the SoundBank path property on AkSoundEngineInitializer
        CreateWwiseGlobalObject();

        // 5. Add AkAudioListener component to camera
        SetListener();

        // 6. Enable "Run In Background" in PlayerSettings (PlayerSettings.runInbackground property)
        PlayerSettings.runInBackground = true;

        AkPluginActivator.Update();
        AkPluginActivator.ActivatePlugins(AkPluginActivator.CONFIG_PROFILE, true);

        // 9. Activate WwiseIDs file generation, and point Wwise to the Assets/Wwise folder
        // 10. Change the SoundBanks options so it adds Max Radius information in the Wwise project
        if (!SetSoundbankSettings())
        {
            Debug.LogWarning("WwiseUnity: Could not modify Wwise Project to generate the header file!");
        }

        // 11. Activate XboxOne network sockets.
        AkXboxOneUtils.EnableXboxOneNetworkSockets();
    }
Ejemplo n.º 4
0
    // Perform all necessary steps to use the Wwise Unity integration.
    public bool Setup()
    {
        bool NoErrorHappened = true;

        // 0. Make sure the soundbank directory exists
        string sbPath = AkUtilities.GetFullPath(Application.streamingAssetsPath, Settings.SoundbankPath);

        if (!Directory.Exists(sbPath))
        {
            Directory.CreateDirectory(sbPath);
        }

        // 1. Disable built-in audio
        if (!DisableBuiltInAudio())
        {
            EditorUtility.DisplayDialog("Warning", "Could not disable built-in audio. Please disable built-in audio by going to Project->Project Settings->Audio, and check \"Disable Audio\".", "Ok");
        }

        // 2. Create a "WwiseGlobal" game object and set the AkSoundEngineInitializer and terminator scripts
        // 3. Set the SoundBank path property on AkSoundEngineInitializer
        if (!Settings.OldProject)
        {
            CreateWwiseGlobalObject();
        }

        // 4. Set the script order of AkInitializer, AkTerminator, AkGameObj, AkBankLoad (before default time), AkAudioListener by changing the .meta file
        if (!SetAllScriptExecutionOrder())
        {
            EditorUtility.DisplayDialog("Error", "Could not change script exec order!", "Ok");
            NoErrorHappened = false;
        }

        // 5. Add AkAudioListener component to camera
        if (!Settings.OldProject)
        {
            SetListener();
        }

        // 6. Enable "Run In Background" in PlayerSettings (PlayerSettings.runInbackground property)
        PlayerSettings.runInBackground = true;

#if !UNITY_5
        // 7. Install the Profile libraries of the installed platforms. This should actually be a change in the way we build unitypackages.
        if (!InstallAllPlatformProfilePlugins())
        {
            EditorUtility.DisplayDialog("Error", "Could not install some platform plugins!", "Ok");
            NoErrorHappened = false;
        }
#else
        AkPluginActivator.ActivatePlugins(AkPluginActivator.CONFIG_PROFILE, true);
#endif

        // 8. Verify DirectX is installed (windows only)
#if UNITY_EDITOR_WIN
        Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\DirectX\\");
        if (key == null)
        {
            EditorUtility.DisplayDialog("Warning", "Detected the DirectX End-User Runtime is not installed. You might have issues using the Windows version of the plugin", "Ok");
        }
#endif
        // 9. Activate WwiseIDs file generation, and point Wwise to the Assets/Wwise folder
        // 10. Change the SoundBanks options so it adds Max Radius information in the Wwise project
        if (!SetSoundbankSettings())
        {
            EditorUtility.DisplayDialog("Warning", "Could not modify Wwise Project to generate the header file!", "Ok");
        }

        // 11. Generate the WwiseIDs.cs file from the .h file
        // GenerateWwiseIDsCsFile();

        // 12. Refresh UI/Settings files.
        Repaint();

        // 13. Make sure the installed SDK matches the one that was build on the machine
        string[] arguments = Environment.GetCommandLineArgs();
        if (Array.IndexOf(arguments, "-nographics") == -1)
        {
            ValidateVersion();
        }

        // 14. Enable Xbox One profiling sockets
        AkXboxOneUtils.EnableXboxOneNetworkSockets();

        // 15. Populate the picker
        AkWwiseProjectInfo.GetData(); // Load data
        if (!String.IsNullOrEmpty(Settings.WwiseProjectPath))
        {
            AkWwiseProjectInfo.Populate();
            AkWwisePicker.PopulateTreeview();
            if (AkWwiseProjectInfo.GetData().autoPopulateEnabled)
            {
                AkWwiseWWUBuilder.StartWWUWatcher();
            }
        }

        return(NoErrorHappened);
    }