Esempio n. 1
0
    public static ReverbSettings SaveSettings(ReverbSettings toSave)
    {
        if (toSave != null)
        {
            ReverbSettings   newSettings  = ReverbSettings.Create(toSave);
            GlobalReverbZone globalReverb = GameObject.FindObjectOfType(typeof(GlobalReverbZone)) as GlobalReverbZone;

            newSettings.beforeSerializePresets();
#if UNITY_EDITOR
            string settingsAssetPath = ReverbSettings.GetSettingsAssetPath();
            if (AssetDatabase.Contains(toSave) == true)
            {
                AssetDatabase.DeleteAsset(settingsAssetPath);
            }
            AssetDatabase.CreateAsset(newSettings, settingsAssetPath);
            AssetDatabase.SaveAssets();

            if (globalReverb != null)
            {
                newSettings.afterDeserializePresets();
                globalReverb.settings  = newSettings;
                LOADED_REVERB_SETTINGS = globalReverb.settings;
                if (EditorApplication.isPlaying || EditorApplication.isPaused)
                {
                    FmodEventSystem.GetReverbManager().UpdateGlobalReverb();
                }
            }
#endif
        }
        else
        {
            Debug.LogError("FMOD_Unity: ReverbSettings: Null reverb settings");
        }
        return(LOADED_REVERB_SETTINGS);
    }
Esempio n. 2
0
    private static void LoadSettings()
    {
        GlobalReverbZone globalReverb = GameObject.FindObjectOfType(typeof(GlobalReverbZone)) as GlobalReverbZone;

        if (LOADED_REVERB_SETTINGS == null)
        {
#if UNITY_EDITOR
            UnityEngine.Object[] tmp = AssetDatabase.LoadAllAssetsAtPath(ReverbSettings.GetSettingsAssetPath());

            if (tmp.Length > 0 && tmp[0] != null)
            {
                LOADED_REVERB_SETTINGS = tmp[0] as ReverbSettings;
                if (LOADED_REVERB_SETTINGS != null)
                {
                    LOADED_REVERB_SETTINGS.afterDeserializePresets();

                    if (globalReverb == null)
                    {
                        GameObject obj = GameObject.Instantiate(Resources.Load("GlobalReverbZone")) as GameObject;
                        globalReverb = obj.GetComponent <GlobalReverbZone>();
                    }
                    if (globalReverb != null)
                    {
                        globalReverb.settings = LOADED_REVERB_SETTINGS;
                    }
                }
            }
#endif
            if (globalReverb != null && LOADED_REVERB_SETTINGS == null)
            {
                LOADED_REVERB_SETTINGS = globalReverb.settings;
                if (LOADED_REVERB_SETTINGS != null)
                {
                    LOADED_REVERB_SETTINGS.afterDeserializePresets();
                }
            }
        }
    }
Esempio n. 3
0
    private static void LoadSettings()
    {
        GlobalReverbZone globalReverb = GameObject.FindObjectOfType(typeof(GlobalReverbZone)) as GlobalReverbZone;

        if (LOADED_REVERB_SETTINGS == null) {
        #if UNITY_EDITOR
            UnityEngine.Object[] tmp = AssetDatabase.LoadAllAssetsAtPath(ReverbSettings.GetSettingsAssetPath());

            if (tmp.Length > 0 && tmp[0] != null) {
                LOADED_REVERB_SETTINGS = tmp[0] as ReverbSettings;
                if (LOADED_REVERB_SETTINGS != null) {
                    LOADED_REVERB_SETTINGS.afterDeserializePresets();

                    if (globalReverb == null) {
                        GameObject obj = GameObject.Instantiate(Resources.Load("GlobalReverbZone")) as GameObject;
                        globalReverb = obj.GetComponent<GlobalReverbZone>();
                    }
                    if (globalReverb != null) {
                        globalReverb.settings = LOADED_REVERB_SETTINGS;
                    }
                }
            }
        #endif
            if (globalReverb != null && LOADED_REVERB_SETTINGS == null) {
                LOADED_REVERB_SETTINGS = globalReverb.settings;
                if (LOADED_REVERB_SETTINGS != null) {
                    LOADED_REVERB_SETTINGS.afterDeserializePresets();
                }
            }
        }
    }