public static bool AutoPopulate() { if (EditorApplication.isPlayingOrWillChangePlaymode || String.IsNullOrEmpty(s_wwiseProjectPath) || EditorApplication.isCompiling ) { return false; } AkWwiseWWUBuilder builder = new AkWwiseWWUBuilder(); if(!builder.GatherModifiedFiles()) return false; builder.UpdateFiles(); return true; }
private static void PostImportFunction() { #if UNITY_2018_1_OR_NEWER UnityEditor.EditorApplication.hierarchyChanged += CheckWwiseGlobalExistance; #else UnityEditor.EditorApplication.hierarchyWindowChanged += CheckWwiseGlobalExistance; #endif UnityEditor.EditorApplication.delayCall += CheckPicker; if (UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode || UnityEditor.EditorApplication.isCompiling) { return; } try { if (System.IO.File.Exists(UnityEngine.Application.dataPath + System.IO.Path.DirectorySeparatorChar + WwiseSettings.WwiseSettingsFilename)) { WwiseSetupWizard.Settings = WwiseSettings.LoadSettings(); AkWwiseProjectInfo.GetData(); } if (!string.IsNullOrEmpty(WwiseSetupWizard.Settings.WwiseProjectPath)) { AkWwisePicker.PopulateTreeview(); if (AkWwiseProjectInfo.GetData().autoPopulateEnabled) { AkWwiseWWUBuilder.StartWWUWatcher(); } } } catch (System.Exception e) { UnityEngine.Debug.Log(e.ToString()); } //Check if a WwiseGlobal object exists in the current scene CheckWwiseGlobalExistance(); }
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); } }
public static bool AutoPopulate() { var fullPath = AkUtilities.GetFullPath(UnityEngine.Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath); AkUtilities.IsWwiseProjectAvailable = System.IO.File.Exists(fullPath); if (!AkUtilities.IsWwiseProjectAvailable || 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; } AkWwiseWWUBuilder builder = new AkWwiseWWUBuilder(); if(!builder.GatherModifiedFiles()) return false; builder.UpdateFiles(); return true; }
public void OnGUI() { GUILayout.BeginHorizontal("Box"); AkWwiseProjectInfo.GetData().autoPopulateEnabled = GUILayout.Toggle(AkWwiseProjectInfo.GetData().autoPopulateEnabled, "Auto populate"); if (AkWwiseProjectInfo.GetData().autoPopulateEnabled&& WwiseProjectFound) { AkWwiseWWUBuilder.StartWWUWatcher(); } else { AkWwiseWWUBuilder.StopWWUWatcher(); } GUILayout.FlexibleSpace(); if (GUILayout.Button("Refresh Project", GUILayout.Width(200))) { treeView.SaveExpansionStatus(); if (AkWwiseProjectInfo.Populate()) { PopulateTreeview(); } } GUILayout.EndHorizontal(); GUILayout.Space(5); treeView.DisplayTreeView(TreeViewControl.DisplayTypes.USE_SCROLL_VIEW); if (GUI.changed && WwiseProjectFound) { EditorUtility.SetDirty(AkWwiseProjectInfo.GetData()); } // TODO: RTP Parameters List }
public void OnGUI() { AkWwiseProjectInfo.DataSourceType ds; var buttonWidth = 150; using (new UnityEngine.GUILayout.HorizontalScope("box")) { ds = (AkWwiseProjectInfo.DataSourceType)UnityEditor.EditorGUILayout.EnumPopup( AkWwiseProjectInfo.GetData().currentDataSource, UnityEngine.GUILayout.Width(buttonWidth)); UnityEngine.GUILayout.Space(5); var projectData = AkWwiseProjectInfo.GetData(); if (ds != projectData.currentDataSource) { projectData.currentDataSource = ds; m_treeView.SetDataSource(AkWwiseProjectInfo.GetTreeData()); } if (ds == AkWwiseProjectInfo.DataSourceType.FileSystem) { projectData.autoPopulateEnabled = UnityEngine.GUILayout.Toggle(projectData.autoPopulateEnabled, "Auto populate"); } else { projectData.AutoSyncSelection = UnityEngine.GUILayout.Toggle(projectData.AutoSyncSelection, "Autosync selection"); AkWwiseProjectInfo.WaapiPickerData.AutoSyncSelection = projectData.AutoSyncSelection; } UnityEngine.GUILayout.FlexibleSpace(); if (UnityEngine.GUILayout.Button("Refresh Project", UnityEngine.GUILayout.Width(buttonWidth))) { if (ds == AkWwiseProjectInfo.DataSourceType.FileSystem) { AkWwiseProjectInfo.Populate(); } Refresh(); } if (UnityEngine.GUILayout.Button("Generate SoundBanks", UnityEngine.GUILayout.Width(buttonWidth))) { if (AkUtilities.IsSoundbankGenerationAvailable()) { AkUtilities.GenerateSoundbanks(); } else { UnityEngine.Debug.LogError("Access to Wwise is required to generate the SoundBanks. Please go to Edit > Project Settings... and set the Wwise Application Path found in the Wwise Editor view."); } } if (projectData.autoPopulateEnabled && AkUtilities.IsWwiseProjectAvailable) { AkWwiseWWUBuilder.StartWWUWatcher(); } else { AkWwiseWWUBuilder.StopWWUWatcher(); } } using (new UnityEngine.GUILayout.HorizontalScope("box")) { var search_width = System.Math.Max(position.width / 3, buttonWidth * 2); if (ds == AkWwiseProjectInfo.DataSourceType.FileSystem) { m_treeView.StoredSearchString = m_SearchField.OnGUI(UnityEngine.GUILayoutUtility.GetRect(search_width, 20), m_treeView.StoredSearchString); UnityEngine.GUILayout.FlexibleSpace(); } else { m_treeView.StoredSearchString = m_SearchField.OnGUI(UnityEngine.GUILayoutUtility.GetRect(search_width, 20), m_treeView.StoredSearchString); UnityEngine.GUILayout.FlexibleSpace(); var labelStyle = new UnityEngine.GUIStyle(); labelStyle.richText = true; UnityEngine.GUILayout.Label(AkWaapiUtilities.GetStatusString(), labelStyle); } } UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing); UnityEngine.GUILayout.FlexibleSpace(); UnityEngine.Rect lastRect = UnityEngine.GUILayoutUtility.GetLastRect(); m_treeView.OnGUI(new UnityEngine.Rect(lastRect.x, lastRect.y, position.width, lastRect.height)); if (UnityEngine.GUI.changed && AkUtilities.IsWwiseProjectAvailable) { UnityEditor.EditorUtility.SetDirty(AkWwiseProjectInfo.GetData()); } }
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)) { AkUtilities.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); if (AkUtilities.IsMigrationRequired(AkUtilities.MigrationStep.NewScriptableObjectFolder_v2019_2_0)) { var oldScriptableObjectPath = System.IO.Path.Combine(System.IO.Path.Combine("Assets", "Wwise"), "Resources"); AkUtilities.MoveFolder(oldScriptableObjectPath, AkWwiseEditorSettings.WwiseScriptableObjectRelativePath); } 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 { // Ignore if not present. } UnityEditor.EditorUtility.ClearProgressBar(); }
// 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); }