using System; using System.Collections; using System.Collections.Generic; using UnityEngine; [Serializable] public class MusicLayer { public AudioSource audioSource; public MusicLayer(AudioSource audioSource) { this.audioSource = audioSource; } public float Volume { get { return audioSource.volume; } set { audioSource.volume = value; } } } public class MusicManager : MonoBehaviour { public List layers; void Start() { List audioSources = new List(); GetComponentsInChildren(true, audioSources); foreach(AudioSource audioSource in audioSources) { MusicLayer layer = new MusicLayer(audioSource); layer.Volume = 0; } } }