Beispiel #1
0
        private void unloadFabricAudio(GameObject gameObject)
        {
            AudioComponent[] componentsInChildren = gameObject.GetComponentsInChildren <AudioComponent>(includeInactive: true);
            int num = componentsInChildren.Length;

            for (int i = 0; i < num; i++)
            {
                AudioComponent audioComponent = componentsInChildren[i];
                audioComponent.Stop();
                audioComponent.UnloadAudio();
                AudioClip audioClip = audioComponent.AudioClip;
                if (audioClip != null && !audioClip.UnloadAudioData())
                {
                    Log.LogError(this, "Failed to unload audio data for: " + audioClip.name);
                }
            }
        }