示例#1
0
    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 (!string.IsNullOrEmpty(AkWwiseEditorSettings.Instance.WwiseProjectPath))
            {
                AkWwisePicker.Refresh(ignoreIfWaapi: true);
                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();
    }
    private static void Tick()
    {
        isTicking = true;

        if (AkWwiseProjectInfo.GetData() != null)
        {
            if (System.DateTime.Now.Subtract(s_lastFileCheck).Seconds > s_SecondsBetweenChecks &&
                !UnityEditor.EditorApplication.isCompiling && !UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode &&
                AkWwiseProjectInfo.GetData().autoPopulateEnabled)
            {
                if (Populate())
                {
                    AkWwiseXMLBuilder.Populate();
                    //check if WAAPI or not
                    AkWwisePicker.Refresh(ignoreIfWaapi: true);
                    //Make sure that the Wwise picker and the inspector are updated
                    AkUtilities.RepaintInspector();
                }

                s_lastFileCheck = System.DateTime.Now;
            }
        }
    }