GetFullPath() public static method

public static GetFullPath ( string BasePath, string RelativePath ) : string
BasePath string
RelativePath string
return string
    public static void ShowHelp()
    {
        try
        {
#if UNITY_EDITOR_WIN
            string arg = "mk:@MSITStore:" + Application.dataPath + "/Wwise/Documentation/WindowsCommon/en/WwiseUnityIntegrationHelp_en.chm::/pg__installation.html";
            System.Diagnostics.Process.Start("hh.exe", arg);
#elif UNITY_EDITOR_OSX
            string DestPath = AkUtilities.GetFullPath(Application.dataPath, "..");
            UnzipHelp(DestPath);
            string docPath = string.Format("{0}/WwiseUnityIntegrationHelp_AppleCommon_en/index.html", DestPath);
            if (File.Exists(docPath))
            {
                AkDocHelper.OpenDoc(docPath);
            }
            else
            {
                Debug.LogError("Wwise documentation not found: " + docPath);
            }
#endif
        }
        catch (Exception)
        {
            Debug.Log("Wwise: Unable to show documentation. Please unzip WwiseUnityIntegrationHelp_AppleCommon_en.zip manually.");
        }
    }
示例#2
0
    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);
    }
示例#3
0
    static string GetPlatformBasePathEditor()
    {
        try
        {
            WwiseSettings Settings             = WwiseSettings.LoadSettings();
            string        platformSubDir       = GetPlatformName();
            string        WwiseProjectFullPath = AkUtilities.GetFullPath(Application.dataPath, Settings.WwiseProjectPath);
            string        SoundBankDest        = AkUtilities.GetWwiseSoundBankDestinationFolder(platformSubDir, WwiseProjectFullPath);
            if (Path.GetPathRoot(SoundBankDest) == "")
            {
                // Path is relative, make it full
                SoundBankDest = AkUtilities.GetFullPath(Path.GetDirectoryName(WwiseProjectFullPath), SoundBankDest);
            }

            // Verify if there are banks in there
            DirectoryInfo di         = new DirectoryInfo(SoundBankDest);
            FileInfo[]    foundBanks = di.GetFiles("*.bnk", SearchOption.AllDirectories);
            if (foundBanks.Length == 0)
            {
                SoundBankDest = string.Empty;
            }

            if (!SoundBankDest.Contains(GetPlatformName()))
            {
                Debug.LogWarning("WwiseUnity: The platform SoundBank subfolder does not match your platform name. You will need to create a custom platform name getter for your game. See section \"Using Wwise Custom Platforms in Unity\" of the Wwise Unity integration documentation for more information");
            }

            return(SoundBankDest);
        }
        catch
        {
            return(string.Empty);
        }
    }
示例#4
0
    // Modify the .wproj file to set needed soundbank settings
    private static bool SetSoundbankSettings()
    {
        if (string.IsNullOrEmpty(Settings.WwiseProjectPath))
        {
            return(true);
        }

        var r             = new System.Text.RegularExpressions.Regex("_WwiseIntegrationTemp.*?([/\\\\])");
        var SoundbankPath = AkUtilities.GetFullPath(r.Replace(UnityEngine.Application.streamingAssetsPath, "$1"),
                                                    Settings.SoundbankPath);
        var WprojPath = AkUtilities.GetFullPath(UnityEngine.Application.dataPath, Settings.WwiseProjectPath);

#if UNITY_EDITOR_OSX
        SoundbankPath = "Z:" + SoundbankPath;
#endif

        SoundbankPath = AkUtilities.MakeRelativePath(System.IO.Path.GetDirectoryName(WprojPath), SoundbankPath);
        if (AkUtilities.EnableBoolSoundbankSettingInWproj("SoundBankGenerateHeaderFile", WprojPath))
        {
            if (AkUtilities.SetSoundbankHeaderFilePath(WprojPath, SoundbankPath))
            {
                return(AkUtilities.EnableBoolSoundbankSettingInWproj("SoundBankGenerateMaxAttenuationInfo", WprojPath));
            }
        }

        return(false);
    }
示例#5
0
    private AkWwiseWWUWatcher()
    {
#if UNITY_EDITOR_WIN
        WwuWatcher = new FileSystemWatcher();
#else
        WwuWatcher = new OSX.IO.FileSystemWatcher.FileSystemWatcher();
#endif
        CallbackTimer      = new System.Threading.Timer(RaisePopulateFlag);
        WwiseProjectFolder = Path.GetDirectoryName(AkUtilities.GetFullPath(Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath));

        try
        {
            WwuWatcher.Path               = WwiseProjectFolder;
            WwuWatcher.NotifyFilter       = NotifyFilters.LastWrite;
            WwuWatcher.InternalBufferSize = 65536;             //64kb (max size)

            // Event handlers that are watching for specific event
            WwuWatcher.Created += new FileSystemEventHandler(WWUWatcher_EventHandler);
            WwuWatcher.Changed += new FileSystemEventHandler(WWUWatcher_EventHandler);
            WwuWatcher.Deleted += new FileSystemEventHandler(WWUWatcher_EventHandler);
            // Wwise does not seem to "rename" files. It creates a new file and deletes the old. We don't need to set the "Renamed" event.

            WwuWatcher.Filter = "*.wwu";
            WwuWatcher.IncludeSubdirectories = true;
            AkWwisePicker.WwiseProjectFound  = true;
        }
        catch (Exception)
        {
            AkWwisePicker.WwiseProjectFound = false;
        }
    }
示例#6
0
    // Modify the .wproj file to set needed soundbank settings
    private static bool SetSoundbankSettings()
    {
        if (string.IsNullOrEmpty(Settings.WwiseProjectPath))
        {
            // Nothing to do here, because setup should succees if Wwise project is not given
            return(true);
        }

        Regex  r             = new Regex("_WwiseIntegrationTemp.*?([/\\\\])");
        string SoundbankPath = AkUtilities.GetFullPath(r.Replace(Application.streamingAssetsPath, "$1"), Settings.SoundbankPath);
        string WprojPath     = AkUtilities.GetFullPath(Application.dataPath, Settings.WwiseProjectPath);

#if UNITY_EDITOR_OSX
        SoundbankPath = "Z:" + SoundbankPath;
#endif

        if (AkUtilities.EnableBoolSoundbankSettingInWproj("SoundBankGenerateHeaderFile", WprojPath))
        {
            if (AkUtilities.SetSoundbankHeaderFilePath(WprojPath, SoundbankPath))
            {
                return(AkUtilities.EnableBoolSoundbankSettingInWproj("SoundBankGenerateMaxAttenuationInfo", WprojPath));
            }
        }
        return(false);
    }
示例#7
0
    public static string GetPlatformBasePathEditor()
    {
        try
        {
            WwiseSettings Settings             = WwiseSettings.LoadSettings();
            string        platformSubDir       = Path.DirectorySeparatorChar == '/' ? "Mac" : "Windows";
            string        WwiseProjectFullPath = AkUtilities.GetFullPath(Application.dataPath, Settings.WwiseProjectPath);
            string        SoundBankDest        = AkUtilities.GetWwiseSoundBankDestinationFolder(platformSubDir, WwiseProjectFullPath);
            if (Path.GetPathRoot(SoundBankDest) == "")
            {
                // Path is relative, make it full
                SoundBankDest = AkUtilities.GetFullPath(Path.GetDirectoryName(WwiseProjectFullPath), SoundBankDest);
            }

            // Verify if there are banks in there
            DirectoryInfo di         = new DirectoryInfo(SoundBankDest);
            FileInfo[]    foundBanks = di.GetFiles("*.bnk", SearchOption.AllDirectories);
            if (foundBanks.Length == 0)
            {
                SoundBankDest = string.Empty;
            }

            return(SoundBankDest);
        }
        catch
        {
            return(string.Empty);
        }
    }
示例#8
0
    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);
    }
示例#9
0
    public static bool Populate()
    {
        try
        {
            if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling)
            {
                return(false);
            }

            if (WwiseSetupWizard.Settings.WwiseProjectPath == null)
            {
                WwiseSettings.LoadSettings();
            }

            if (String.IsNullOrEmpty(WwiseSetupWizard.Settings.WwiseProjectPath))
            {
                Debug.LogError("WwiseUnity: Wwise project needed to populate from Work Units. Aborting.");
                return(false);
            }

            s_wwiseProjectPath = Path.GetDirectoryName(AkUtilities.GetFullPath(Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath));
            return(AutoPopulate());
        }
        catch (Exception e)
        {
            Debug.LogError(e.ToString());
            EditorUtility.ClearProgressBar();
        }
        return(true);    //There was an error, assume that we need to refresh.
    }
示例#10
0
    public static void OpenDociOS()
    {
        string DestPath = AkUtilities.GetFullPath(Application.dataPath, "..");
        string docPath  = string.Format("{0}/WwiseUnityIntegrationHelp_AppleCommon_en/index.html", DestPath);

        AkDocHelper.OpenDoc(docPath);
    }
示例#11
0
    public static void InitializeWwiseProjectData()
    {
        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;
            }

            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;
            }

            var builder = new AkWwiseWWUBuilder();
            builder.GatherModifiedFiles();
            builder.UpdateFiles();
        }
        catch
        {
        }
    }
示例#12
0
    static public IDictionary <string, string> GetAllBankPaths()
    {
        WwiseSettings Settings             = WwiseSettings.LoadSettings();
        string        WwiseProjectFullPath = AkUtilities.GetFullPath(Application.dataPath, Settings.WwiseProjectPath);

        UpdateSoundbanksDestinationFolders(WwiseProjectFullPath);
        return(s_ProjectBankPaths);
    }
        public static void SetupSoundbankSetting()
        {
            var WprojPath = AkUtilities.GetFullPath(UnityEngine.Application.dataPath, WwiseSettings.LoadSettings().WwiseProjectPath);

            AkUtilities.EnableBoolSoundbankSettingInWproj("SoundBankGenerateEstimatedDuration", WprojPath);

            UnityEditor.EditorApplication.update  += RunOnce;
            AkWwiseXMLWatcher.Instance.XMLUpdated += UpdateAllClips;
        }
示例#14
0
    void GenerateWwiseIDsCsFile()
    {
        string SoundbankPath = AkUtilities.GetFullPath(Application.streamingAssetsPath, Settings.SoundbankPath);

        if (File.Exists(Path.Combine(SoundbankPath, "Wwise_IDs.h")))
        {
            AkWwiseIDConverter converter = new AkWwiseIDConverter(SoundbankPath);
            converter.Convert(false);
        }
    }
示例#15
0
    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);
        }
    }
示例#16
0
    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 override void DisplayTreeView(DisplayTypes displayType)
    {
        if (AkWwisePicker.WwiseProjectFound)
        {
            var filterString = m_filterString;

            if (m_filterBoxStyle == null)
            {
                m_filterBoxStyle = UnityEngine.Object
                                   .Instantiate(UnityEditor.EditorGUIUtility.GetBuiltinSkin(UnityEditor.EditorSkin.Inspector))
                                   .FindStyle("SearchTextField");
                m_filterBoxCancelButtonStyle = UnityEngine.Object
                                               .Instantiate(UnityEditor.EditorGUIUtility.GetBuiltinSkin(UnityEditor.EditorSkin.Inspector))
                                               .FindStyle("SearchCancelButton");
            }

            UnityEngine.GUILayout.BeginHorizontal("Box");
            {
                m_filterString = UnityEngine.GUILayout.TextField(m_filterString, m_filterBoxStyle);
                if (UnityEngine.GUILayout.Button("", m_filterBoxCancelButtonStyle))
                {
                    m_filterString = "";
                }
            }
            UnityEngine.GUILayout.EndHorizontal();

            if (!m_filterString.Equals(filterString))
            {
                if (filterString.Equals(string.Empty))
                {
                    SaveExpansionStatus();
                }

                FilterTreeview(RootItem);

                if (m_filterString.Equals(string.Empty))
                {
                    var path = "";
                    RestoreExpansionStatus(RootItem, ref path);
                }
            }

            base.DisplayTreeView(displayType);
        }
        else
        {
            UnityEngine.GUILayout.Label("Wwise Project not found at path:");
            UnityEngine.GUILayout.Label(AkUtilities.GetFullPath(UnityEngine.Application.dataPath,
                                                                WwiseSetupWizard.Settings.WwiseProjectPath));
            UnityEngine.GUILayout.Label("Wwise Picker will not be usable.");
        }
    }
示例#18
0
    /// <summary>
    /// Tries to communicate with Wwise and compares the current open project with the project path specified in the Unity Wwise Editor settings.
    /// </summary>
    /// <returns>True if the correct wwise project is open in Wwise.</returns>
    private async static Task <bool> CheckProjectLoaded()
    {
        try
        {
            var result = await GetProjectInfo();

            if (result.Count == 0)
            {
                throw new Wamp.ErrorException("Did not get a response from Wwise project");
            }
            var projectInfo = result[0];
#if UNITY_EDITOR_OSX
            var d1 = AkUtilities.ParseOsxPathFromWinePath(projectInfo.filePath);
#else
            var d1 = projectInfo.filePath;
#endif
            var d2 = AkUtilities.GetFullPath(dataPath, AkWwiseEditorSettings.Instance.WwiseProjectPath);
            d1 = d1.Replace("/", "\\");
            d2 = d2.Replace("/", "\\");
            if (d1 != d2)
            {
                ConnectionFailed($"The wrong project({projectInfo.name}) is open in Wwise");
                return(false);
            }
        }

        catch (Wamp.ErrorException e)
        {
            if (e.Json != null)
            {
                ErrorMessage msg = UnityEngine.JsonUtility.FromJson <ErrorMessage>(e.Json);
                if (msg != null)
                {
                    if (msg.message != null)
                    {
                        ErrorMessage = msg.message;
                    }
                }
            }
            if (e.Uri == "ak.wwise.locked")
            {
                return(true);
            }


            ConnectionFailed($"No project is open in Wwise yet");
            return(false);
        }

        return(true);
    }
    public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
    {
#if UNITY_EDITOR
        WwiseSettings Settings  = WwiseSettings.LoadSettings();
        string        WprojPath = AkUtilities.GetFullPath(Application.dataPath, Settings.WwiseProjectPath);
        AkUtilities.EnableBoolSoundbankSettingInWproj("SoundBankGenerateEstimatedDuration", WprojPath);
#endif
        var playable = ScriptPlayable <AkEventPlayableBehavior> .Create(graph);

        playable.SetInputCount(inputCount);
        setFadeTimes();
        setOwnerClips();
        return(playable);
    }
示例#20
0
    public override UnityEngine.Playables.Playable CreateTrackMixer(UnityEngine.Playables.PlayableGraph graph,
                                                                    UnityEngine.GameObject go, int inputCount)
    {
#if UNITY_EDITOR
        var Settings  = WwiseSettings.LoadSettings();
        var WprojPath = AkUtilities.GetFullPath(UnityEngine.Application.dataPath, Settings.WwiseProjectPath);
        AkUtilities.EnableBoolSoundbankSettingInWproj("SoundBankGenerateEstimatedDuration", WprojPath);
#endif
        var playable = UnityEngine.Playables.ScriptPlayable <AkEventPlayableBehavior> .Create(graph);

        UnityEngine.Playables.PlayableExtensions.SetInputCount(playable, inputCount);
        setFadeTimes();
        setOwnerClips();
        return(playable);
    }
示例#21
0
    void OnEnable()
    {
        if (string.IsNullOrEmpty(WwiseSettings.LoadSettings().WwiseProjectPath))
        {
            return;
        }

        string[] dir = { "Events", "States", "Switches", "Master-Mixer Hierarchy", "SoundBanks" };
        string   wwiseProjectPath = Path.GetDirectoryName(AkUtilities.GetFullPath(Application.dataPath, WwiseSettings.LoadSettings().WwiseProjectPath));

        try
        {
            for (int i = 0; i < dir.Length; i++)
            {
                DirectoryInfo dirInfo = new DirectoryInfo(Path.Combine(wwiseProjectPath, dir[i]));
                FileInfo[]    files   = dirInfo.GetFiles("*.wwu", SearchOption.AllDirectories);

                ArrayList     list     = AkWwiseProjectInfo.GetData().GetWwuListByString(dir[i]);
                List <string> pathList = new List <string>(list.Count);
                for (int j = 0; j < list.Count; j++)
                {
                    pathList.Add(Path.Combine(wwiseProjectPath, (list[j] as AkWwiseProjectData.WorkUnit).PhysicalPath));
                }

                foreach (FileInfo file in files)
                {
                    if (file.LastWriteTime.CompareTo(AkWwiseProjectInfo.GetData().GetLastPopulateTime()) > 0)
                    {
                        AkWwiseWWUBuilder.s_createdWwu.Add(file.FullName);
                    }

                    pathList.Remove(file.FullName);
                }

                AkWwiseWWUBuilder.s_deletedWwu.AddRange(pathList);
            }
            if (AkWwiseWWUBuilder.s_createdWwu.Count != 0 || AkWwiseWWUBuilder.s_deletedWwu.Count != 0)
            {
                treeView.SaveExpansionStatus();
                AkWwiseWWUBuilder.AutoPopulate();
                PopulateTreeview();
            }
        }
        catch (Exception)
        {
            WwiseProjectFound = false;
        }
    }
示例#22
0
    /// <summary>
    ///     Determines the platform base path for use within the Editor.
    /// </summary>
    /// <param name="platformName">The platform name.</param>
    /// <returns>The full path to the sound banks for use within the Editor.</returns>
    public static string GetPlatformBasePathEditor(string platformName)
    {
        var Settings             = WwiseSettings.LoadSettings();
        var WwiseProjectFullPath = AkUtilities.GetFullPath(UnityEngine.Application.dataPath, Settings.WwiseProjectPath);
        var SoundBankDest        = AkUtilities.GetWwiseSoundBankDestinationFolder(platformName, WwiseProjectFullPath);

        try
        {
            if (System.IO.Path.GetPathRoot(SoundBankDest) == "")
            {
                // Path is relative, make it full
                SoundBankDest = AkUtilities.GetFullPath(System.IO.Path.GetDirectoryName(WwiseProjectFullPath), SoundBankDest);
            }
        }
        catch
        {
            SoundBankDest = string.Empty;
        }

        if (string.IsNullOrEmpty(SoundBankDest))
        {
            UnityEngine.Debug.LogWarning("WwiseUnity: The platform SoundBank subfolder within the Wwise project could not be found.");
        }
        else
        {
            try
            {
                // Verify if there are banks in there
                var di         = new System.IO.DirectoryInfo(SoundBankDest);
                var foundBanks = di.GetFiles("*.bnk", System.IO.SearchOption.AllDirectories);
                if (foundBanks.Length == 0)
                {
                    SoundBankDest = string.Empty;
                }
                else if (!SoundBankDest.Contains(platformName))
                {
                    UnityEngine.Debug.LogWarning(
                        "WwiseUnity: The platform SoundBank subfolder does not match your platform name. You will need to create a custom platform name getter for your game. See section \"Using Wwise Custom Platforms in Unity\" of the Wwise Unity integration documentation for more information");
                }
            }
            catch
            {
                SoundBankDest = string.Empty;
            }
        }

        return(SoundBankDest);
    }
示例#23
0
    // 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();
    }
    public static void OpenDocMac()
    {
        string DestPath = AkUtilities.GetFullPath(Application.dataPath, "..");
        string docPath  = string.Format("{0}/WwiseUnityIntegrationHelp_AppleCommon_en/index.html", DestPath);

        if (!File.Exists(docPath))
        {
            WwiseSetupWizard.UnzipHelp(DestPath);
        }

        if (File.Exists(docPath))
        {
            AkDocHelper.OpenDoc(docPath);
        }
        else
        {
            UnityEngine.Debug.Log("Wwise: Unable to show documentation. Please unzip WwiseUnityIntegrationHelp_AppleCommon_en.zip manually.");
        }
    }
示例#25
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();
    }
    static string GetLocalDocUrl(string platform)
    {
        string docUrl  = string.Empty;
        string docPath = string.Empty;

#if UNITY_EDITOR_WIN
        if (platform == "Windows")
        {
            docPath = string.Format("{0}/Wwise/Documentation/{1}/en/WwiseUnityIntegrationHelp_en.chm", Application.dataPath, platform);
        }
        else
        {
            docPath = string.Format("{0}/Wwise/Documentation/{1}/en/WwiseUnityIntegrationHelp_{1}_en.chm", Application.dataPath, platform);
        }
#else
        string DestPath = AkUtilities.GetFullPath(Application.dataPath, "../WwiseUnityIntegrationHelp_en");
        docPath = string.Format("{0}/html/index.html", DestPath);
        if (!File.Exists(docPath))
        {
            UnzipHelp(DestPath);
        }

        if (!File.Exists(docPath))
        {
            UnityEngine.Debug.Log("WwiseUnity: Unable to show documentation. Please unzip WwiseUnityIntegrationHelp_AppleCommon_en.zip manually.");
            return(string.Empty);
        }
#endif

        FileInfo fi = new FileInfo(docPath);
        if (!fi.Exists)
        {
            UnityEngine.Debug.LogError(string.Format("WwiseUnity: Failed to find documentation: {0}. Aborted.", docPath));
            return(string.Empty);
        }
        docUrl = string.Format("file:///{0}", docPath.Replace(" ", "%20"));

        return(docUrl);
    }
    public static void Update(bool forceUpdate = false)
    {
        //Gather all GeneratedSoundBanks folder from the project
        var allPaths     = AkUtilities.GetAllBankPaths();
        var bNeedRefresh = false;
        var projectPath  = System.IO.Path.GetDirectoryName(AkUtilities.GetFullPath(UnityEngine.Application.dataPath,
                                                                                   WwiseSettings.LoadSettings().WwiseProjectPath));

        var pfMap = AkUtilities.GetPlatformMapping();

        //Go through all BasePlatforms
        foreach (var pairPF in pfMap)
        {
            //Go through all custom platforms related to that base platform and check if any of the bank files were updated.
            var bParse    = forceUpdate;
            var fullPaths = new System.Collections.Generic.List <string>();
            foreach (var customPF in pairPF.Value)
            {
                string bankPath;
                if (!allPaths.TryGetValue(customPF, out bankPath))
                {
                    continue;
                }

                var pluginFile = "";
                try
                {
                    pluginFile = System.IO.Path.Combine(projectPath, System.IO.Path.Combine(bankPath, "PluginInfo.xml"));
                    pluginFile = pluginFile.Replace('/', System.IO.Path.DirectorySeparatorChar);
                    if (!System.IO.File.Exists(pluginFile))
                    {
                        //Try in StreamingAssets too.
                        pluginFile = System.IO.Path.Combine(System.IO.Path.Combine(AkBasePathGetter.GetFullSoundBankPath(), customPF),
                                                            "PluginInfo.xml");
                        if (!System.IO.File.Exists(pluginFile))
                        {
                            continue;
                        }
                    }

                    fullPaths.Add(pluginFile);

                    var t        = System.IO.File.GetLastWriteTime(pluginFile);
                    var lastTime = System.DateTime.MinValue;
                    s_LastParsed.TryGetValue(customPF, out lastTime);
                    if (lastTime < t)
                    {
                        bParse = true;
                        s_LastParsed[customPF] = t;
                    }
                }
                catch (System.Exception ex)
                {
                    UnityEngine.Debug.LogError("WwiseUnity: " + pluginFile + " could not be parsed. " + ex.Message);
                }
            }

            if (bParse)
            {
                var platform = pairPF.Key;

                var newDlls = ParsePluginsXML(platform, fullPaths);
                System.Collections.Generic.HashSet <string> oldDlls = null;

                //Remap base Wwise platforms to Unity platform folders names
                if (platform.Contains("Vita"))
                {
                    platform = "Vita";
                }
                //else other platforms already have the right name

                s_PerPlatformPlugins.TryGetValue(platform, out oldDlls);
                s_PerPlatformPlugins[platform] = newDlls;

                //Check if there was any change.
                if (!bNeedRefresh && oldDlls != null)
                {
                    if (oldDlls.Count == newDlls.Count)
                    {
                        oldDlls.IntersectWith(newDlls);
                    }

                    bNeedRefresh |= oldDlls.Count != newDlls.Count;
                }
                else
                {
                    bNeedRefresh |= newDlls.Count > 0;
                }
            }
        }

        if (bNeedRefresh)
        {
            ActivatePluginsForEditor();
        }

        var currentConfig = GetCurrentConfig();

        CheckMenuItems(currentConfig);
    }
示例#28
0
    public static void Populate()
    {
        try
        {
            if (EditorApplication.isPlaying)
            {
                return;
            }

            if (WwiseSetupWizard.Settings.WwiseProjectPath == null)
            {
                WwiseSettings.LoadSettings();
            }

            if (String.IsNullOrEmpty(WwiseSetupWizard.Settings.WwiseProjectPath))
            {
                Debug.LogError("Wwise project needed to populate from Work Units. Aborting.");
                return;
            }

            s_wwiseProjectPath = Path.GetDirectoryName(AkUtilities.GetFullPath(Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath));

            if (!Directory.Exists(s_wwiseProjectPath))
            {
                AkWwisePicker.WwiseProjectFound = false;
                return;
            }
            else
            {
                AkWwisePicker.WwiseProjectFound = true;
            }

            AkWwiseProjectInfo.GetData().EventWwu.Clear();
            AkWwiseProjectInfo.GetData().AuxBusWwu.Clear();
            AkWwiseProjectInfo.GetData().StateWwu.Clear();
            AkWwiseProjectInfo.GetData().SwitchWwu.Clear();
            AkWwiseProjectInfo.GetData().BankWwu.Clear();



            s_currentWwuCnt = 0;

            List <AssetType> AssetsToParse = new List <AssetType>();
            AssetsToParse.Add(new AssetType("Events", "Event", ""));
            AssetsToParse.Add(new AssetType("States", "StateGroup", "State"));
            AssetsToParse.Add(new AssetType("Switches", "SwitchGroup", "Switch"));
            AssetsToParse.Add(new AssetType("Master-Mixer Hierarchy", "AuxBus", ""));
            AssetsToParse.Add(new AssetType("SoundBanks", "SoundBank", ""));

            s_totWwuCnt = GetNumOfWwus(AssetsToParse);

            foreach (AssetType asset in AssetsToParse)
            {
                bool bSuccess = PopulateListOfType(asset);
                if (!bSuccess)
                {
                    Debug.LogError("Error when parsing the work units for " + asset.XmlElementName + " .");
                }
                else
                {
                    AkWwiseProjectInfo.GetData().GetWwuListByString(asset.RootDirectoryName).Sort(AkWwiseProjectData.s_compareByPhysicalPath);
                }
            }

            EditorUtility.ClearProgressBar();

            AkWwiseProjectInfo.GetData().SetLastPopulateTime(DateTime.Now);
        }
        catch (Exception e)
        {
            Debug.LogError(e.ToString());
            EditorUtility.ClearProgressBar();
        }
    }
            public override void OnGUI(string searchContext)

            {
                bool changed = false;

                var labelWidth = UnityEditor.EditorGUIUtility.labelWidth;

                UnityEditor.EditorGUIUtility.labelWidth += 100;

                var settings = Instance;

                UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);
                UnityEngine.GUILayout.Label(Styles.AddressablesSettings, UnityEditor.EditorStyles.boldLabel);
                UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);

                UnityEditor.EditorGUI.BeginChangeCheck();

                using (new UnityEngine.GUILayout.VerticalScope("box"))
                {
                    bool newValue = UnityEditor.EditorGUILayout.Toggle(Styles.UseSampleMetadataPreserver, settings.UseSampleMetadataPreserver);
                    if (settings.UseSampleMetadataPreserver != newValue)
                    {
                        settings.UseSampleMetadataPreserver = newValue;
                        if (settings.UseSampleMetadataPreserver)
                        {
                            WwiseAddressableAssetMetadataPreserver.BindMetadataDelegate();
                        }
                        else
                        {
                            WwiseAddressableAssetMetadataPreserver.UnbindMetaDataDelegate();
                        }
                    }
                    UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);

                    using (new UnityEngine.GUILayout.HorizontalScope())
                    {
                        if (settings.UseSampleMetadataPreserver)
                        {
                            UnityEditor.EditorGUILayout.PrefixLabel(Styles.MetadataPath);
                            UnityEditor.EditorGUILayout.SelectableLabel(settings.MetadataPath, Styles.TextField, UnityEngine.GUILayout.Height(17));
                            if (Ellipsis())
                            {
                                var OpenInPath      = System.IO.Path.GetDirectoryName(AkUtilities.GetFullPath(UnityEngine.Application.dataPath, settings.MetadataPath));
                                var MetadataPathNew = UnityEditor.EditorUtility.OpenFolderPanel("Select your metadata Project", OpenInPath, "WwiseAddressableMetadata");
                                if (MetadataPathNew.Length != 0)
                                {
                                    settings.MetadataPath = AkUtilities.MakeRelativePath(UnityEngine.Application.dataPath, MetadataPathNew);
                                    changed = true;
                                }
                            }
                        }
                    }
                }


                if (UnityEditor.EditorGUI.EndChangeCheck())
                {
                    changed = true;
                }

                UnityEngine.GUILayout.Space(UnityEditor.EditorGUIUtility.standardVerticalSpacing);

                UnityEditor.EditorGUIUtility.labelWidth = labelWidth;

                if (changed)
                {
                    settings.SaveSettings();
                }
            }
示例#30
0
    public override void DisplayTreeView(DisplayTypes displayType)
    {
        if (AkUtilities.IsWwiseProjectAvailable)
        {
            var filterString = m_filterString;

            if (m_filterBoxStyle == null)
            {
                m_filterBoxStyle = UnityEngine.Object
                                   .Instantiate(UnityEditor.EditorGUIUtility.GetBuiltinSkin(UnityEditor.EditorSkin.Inspector))
                                   .FindStyle("SearchTextField");
                m_filterBoxCancelButtonStyle = UnityEngine.Object
                                               .Instantiate(UnityEditor.EditorGUIUtility.GetBuiltinSkin(UnityEditor.EditorSkin.Inspector))
                                               .FindStyle("SearchCancelButton");
            }

            using (new UnityEngine.GUILayout.HorizontalScope("box"))
            {
                m_filterString = UnityEngine.GUILayout.TextField(m_filterString, m_filterBoxStyle);
                if (UnityEngine.GUILayout.Button("", m_filterBoxCancelButtonStyle))
                {
                    m_filterString = "";
                }
            }

            if (!m_filterString.Equals(filterString))
            {
                if (filterString.Equals(string.Empty))
                {
                    SaveExpansionStatus();
                }

                FilterTreeview(RootItem);

                if (m_filterString.Equals(string.Empty))
                {
                    var path = "";
                    RestoreExpansionStatus(RootItem, ref path);
                }
            }

            base.DisplayTreeView(displayType);
        }
        else
        {
            var saveWordWrap = UnityEngine.GUI.skin.label.wordWrap;
            UnityEngine.GUI.skin.label.wordWrap = true;
            UnityEngine.GUILayout.Label(string.Format("Wwise Project not found at path:\n{0}\n\nWwise Picker will not be usable.", AkUtilities.GetFullPath(UnityEngine.Application.dataPath, WwiseSetupWizard.Settings.WwiseProjectPath)), UnityEngine.GUILayout.ExpandHeight(true));
            UnityEngine.GUI.skin.label.wordWrap = saveWordWrap;
        }
    }