Ejemplo n.º 1
0
    public static void TryAddONSPToAllAudioSources(bool newAudioSourcesOnly, bool includeInactive)
    {
        AudioSource[] allAudioSources = includeInactive ? Resources.FindObjectsOfTypeAll <AudioSource>() : Object.FindObjectsOfType <AudioSource>();
        foreach (AudioSource src in allAudioSources)
        {
            if (src == null || src.gameObject == null || !src.enabled || src.gameObject.scene != UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene())
            {
                continue;
            }

            if (newAudioSourcesOnly)
            {
                if (!IsNewAudioSource(src))
                {
                    continue;
                }

                src.spatialBlend = 1.0f;  // set 3D mode

                UnityEngine.Audio.AudioMixerGroup mixer = AssetDatabase.LoadAssetAtPath <UnityEngine.Audio.AudioMixerGroup>("Assets/VRCSDK/Dependencies/OSPNative/scenes/mixers/SpatializerMixer.mixer");
                if (mixer != null)
                {
                    src.outputAudioMixerGroup = mixer;
                }
            }

            if (AddONSPAudioSourceComponent.ApplyDefaultSpatializationToAudioSource(src))
            {
                Debug.Log("Automatically added ONSPAudioSource component and enabled spatialized audio to " + GetGameObjectPath(src.gameObject) + "!");
            }
        }
    }
Ejemplo n.º 2
0
 // Token: 0x060063F8 RID: 25592 RVA: 0x00237A90 File Offset: 0x00235E90
 public static void ApplyDefaultSpatializationToAudioSources()
 {
     AudioSource[] array = UnityEngine.Object.FindObjectsOfType <AudioSource>();
     foreach (AudioSource audioSrc in array)
     {
         AddONSPAudioSourceComponent.ApplyDefaultSpatializationToAudioSource(audioSrc);
     }
 }