public static bool AutoPopulate() { if (!System.IO.File.Exists(AudioPluginSettingAgent.DeveloperWwiseProjectPath)) { AkWwisePicker.WwiseProjectFound = false; return(false); } AkWwisePicker.WwiseProjectFound = true; if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || string.IsNullOrEmpty(s_wwiseProjectPath) || UnityEditor.EditorApplication.isCompiling) { return(false); } AkPluginActivator.Update(); var builder = new AkWwiseWWUBuilder(); if (!builder.GatherModifiedFiles()) { return(false); } builder.UpdateFiles(); return(true); }
public static bool AutoPopulate() { if (!System.IO.File.Exists(AkUtilities.GetFullPath(UnityEngine.Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath))) { AkWwisePicker.WwiseProjectFound = false; return(false); } AkWwisePicker.WwiseProjectFound = true; if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || string.IsNullOrEmpty(s_wwiseProjectPath) || UnityEditor.EditorApplication.isCompiling) { return(false); } AkPluginActivator.Update(); var builder = new AkWwiseWWUBuilder(); if (!builder.GatherModifiedFiles()) { return(false); } builder.UpdateFiles(); return(true); }
public static bool AutoPopulate() { if (!File.Exists(AkUtilities.GetFullPath(Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath))) { AkWwisePicker.WwiseProjectFound = false; return(false); } else { AkWwisePicker.WwiseProjectFound = true; } if (EditorApplication.isPlayingOrWillChangePlaymode || String.IsNullOrEmpty(s_wwiseProjectPath) || EditorApplication.isCompiling) { return(false); } AkPluginActivator.Update(); if (!AkWwiseProjectInfo.GetData().autoPopulateEnabled) { return(false); } AkWwiseWWUBuilder builder = new AkWwiseWWUBuilder(); if (!builder.GatherModifiedFiles()) { return(false); } builder.UpdateFiles(); return(true); }
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 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(); }
private static void RefreshCallback() { PostImportFunction(); if (WwiseSettings.Exists) { AkPluginActivator.Update(); AkPluginActivator.ActivatePluginsForEditor(); } }
private static void RefreshCallback() { PostImportFunction(); if (File.Exists(Path.Combine(Application.dataPath, WwiseSettings.WwiseSettingsFilename))) { AkPluginActivator.Update(); AkPluginActivator.ActivatePluginsForEditor(); } }
public static bool Populate() { try { if (WwiseSetupWizard.Settings.WwiseProjectPath == null) { WwiseSettings.LoadSettings(); } if (string.IsNullOrEmpty(WwiseSetupWizard.Settings.WwiseProjectPath)) { UnityEngine.Debug.LogError("WwiseUnity: Wwise project needed to populate from Work Units. Aborting."); return(false); } var fullWwiseProjectPath = AkUtilities.GetFullPath(UnityEngine.Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath); s_wwiseProjectPath = System.IO.Path.GetDirectoryName(fullWwiseProjectPath); AkUtilities.IsWwiseProjectAvailable = System.IO.File.Exists(fullWwiseProjectPath); if (!AkUtilities.IsWwiseProjectAvailable || UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || string.IsNullOrEmpty(s_wwiseProjectPath) || UnityEditor.EditorApplication.isCompiling) { return(false); } AkPluginActivator.Update(); var builder = new AkWwiseWWUBuilder(); if (WwiseObjectReference.migrate == null && !builder.GatherModifiedFiles()) { return(false); } builder.UpdateFiles(); if (WwiseObjectReference.migrate != null) { UpdateWwiseObjectReferenceData(); PopulateWwiseObjectReferences(); UnityEditor.AssetDatabase.SaveAssets(); var currentScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene(); UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(currentScene); } return(true); } catch (System.Exception e) { UnityEngine.Debug.LogError(e.ToString()); UnityEditor.EditorUtility.ClearProgressBar(); return(true); } }
public static bool Populate() { try { if (WwiseSetupWizard.Settings.WwiseProjectPath == null) { WwiseSettings.LoadSettings(); } if (string.IsNullOrEmpty(WwiseSetupWizard.Settings.WwiseProjectPath)) { UnityEngine.Debug.LogError("WwiseUnity: Wwise project needed to populate from Work Units. Aborting."); return(false); } s_wwiseProjectPath = System.IO.Path.GetDirectoryName(AkUtilities.GetFullPath(UnityEngine.Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath)); if (!System.IO.File.Exists(AkUtilities.GetFullPath(UnityEngine.Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath))) { AkWwisePicker.WwiseProjectFound = false; return(false); } AkWwisePicker.WwiseProjectFound = true; if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || string.IsNullOrEmpty(s_wwiseProjectPath) || UnityEditor.EditorApplication.isCompiling) { return(false); } AkPluginActivator.Update(); var builder = new AkWwiseWWUBuilder(); if (!builder.GatherModifiedFiles()) { return(false); } builder.UpdateFiles(); return(true); } catch (System.Exception e) { UnityEngine.Debug.LogError(e.ToString()); UnityEditor.EditorUtility.ClearProgressBar(); } return(true); //There was an error, assume that we need to refresh. }
public static void ModifySetup() { string currentConfig = AkPluginActivator.GetCurrentConfig(); if (String.IsNullOrEmpty(currentConfig)) { currentConfig = AkPluginActivator.CONFIG_PROFILE; } AkPluginActivator.DeactivateAllPlugins(); AkPluginActivator.Update(); AkPluginActivator.ActivatePlugins(currentConfig, true); }
public void OnPreprocessBuild(BuildTarget target, string path) { if (WwiseSetupWizard.Settings.CopySoundBanksAsPreBuildStep) { string platformName = GetPlatformName(target); if (!CopySoundbanks(WwiseSetupWizard.Settings.GenerateSoundBanksAsPreBuildStep, platformName, ref destinationSoundBankFolder)) { Debug.LogError("WwiseUnity: Soundbank folder has not been copied for <" + target + "> target at <" + path + ">. This will likely result in a build without sound!!!"); } } // @todo sjl - only update for target platform AkPluginActivator.Update(true); AkPluginActivator.ActivatePluginsForDeployment(target, true); }
public void OnPreprocessBuildInternal(UnityEditor.BuildTarget target, string path) { if (AkWwiseEditorSettings.Instance.CopySoundBanksAsPreBuildStep) { var platformName = GetPlatformName(target); if (!CopySoundbanks(AkWwiseEditorSettings.Instance.GenerateSoundBanksAsPreBuildStep, platformName, ref destinationSoundBankFolder)) { UnityEngine.Debug.LogErrorFormat("WwiseUnity: SoundBank folder has not been copied for <{0}> target at <{1}>. This will likely result in a build without sound!!!", target, path); } } // @todo sjl - only update for target platform AkPluginActivator.Update(true); AkPluginActivator.ActivatePluginsForDeployment(target, true); }
// Perform all necessary steps to use the Wwise Unity integration. private static void Setup() { UnityEditor.SceneManagement.EditorSceneManager.NewScene(UnityEditor.SceneManagement.NewSceneSetup.DefaultGameObjects); AkPluginActivator.DeactivateAllPlugins(); // 0. Make sure the SoundBank directory exists var sbPath = AkUtilities.GetFullPath(UnityEngine.Application.streamingAssetsPath, AkWwiseEditorSettings.Instance.SoundbankPath); if (!System.IO.Directory.Exists(sbPath)) { System.IO.Directory.CreateDirectory(sbPath); } // 1. Disable built-in audio if (!DisableBuiltInAudio()) { UnityEngine.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. Disable the built-in audio listener, and add AkAudioListener component to camera if (AkWwiseEditorSettings.Instance.CreateWwiseListener) { AddAkAudioListenerToMainCamera(); } // 6. Enable "Run In Background" in PlayerSettings (PlayerSettings.runInbackground property) UnityEditor.PlayerSettings.runInBackground = true; AkPluginActivator.Update(); AkPluginActivator.ActivatePluginsForEditor(); // 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()) { UnityEngine.Debug.LogWarning("WwiseUnity: Could not modify Wwise Project to generate the header file!"); } // 11. Activate XboxOne network sockets. AkXboxOneUtils.EnableXboxOneNetworkSockets(); }
static void RefreshCallback() { PostImportFunction(); if (File.Exists(Path.Combine(Application.dataPath, WwiseSettings.WwiseSettingsFilename))) { AkPluginActivator.Update(); AkPluginActivator.RefreshPlugins(); #if UNITY_5 // Check if platform is supported and installed string Msg; if (!CheckPlatform(out Msg)) { EditorUtility.DisplayDialog("Warning", Msg, "OK"); } #endif } }
// 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(); }
private static void RefreshCallback() { PostImportFunction(); if (File.Exists(Path.Combine(Application.dataPath, WwiseSettings.WwiseSettingsFilename))) { AkPluginActivator.Update(); AkPluginActivator.RefreshPlugins(); // Check if platform is supported and installed. PluginImporter might contain // erroneous data when application is compiling or updating, so skip this if // that is the case. if (!EditorApplication.isCompiling && !EditorApplication.isUpdating) { string Msg; if (!CheckPlatform(out Msg)) { EditorUtility.DisplayDialog("Warning", Msg, "OK"); } } } }
public static bool Populate() { try { if (string.IsNullOrEmpty(AkWwiseEditorSettings.Instance.WwiseProjectPath)) { UnityEngine.Debug.LogError("WwiseUnity: Wwise project needed to populate from Work Units. Aborting."); return(false); } var fullWwiseProjectPath = AkWwiseEditorSettings.WwiseProjectAbsolutePath; s_wwiseProjectPath = System.IO.Path.GetDirectoryName(fullWwiseProjectPath); AkUtilities.IsWwiseProjectAvailable = System.IO.File.Exists(fullWwiseProjectPath); if (!AkUtilities.IsWwiseProjectAvailable || UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || string.IsNullOrEmpty(s_wwiseProjectPath) || (UnityEditor.EditorApplication.isCompiling && !AkUtilities.IsMigrating)) { return(false); } AkPluginActivator.Update(); var builder = new AkWwiseWWUBuilder(); if (!builder.GatherModifiedFiles()) { return(false); } builder.UpdateFiles(); return(true); } catch (System.Exception e) { UnityEngine.Debug.LogError(e.ToString()); UnityEditor.EditorUtility.ClearProgressBar(); return(true); } }