Exemple #1
0
        void Awake()
        {
            //if the manager is null
            if (_instance == null)
            {
                //init the manager
                DontDestroyOnLoad(gameObject);
                _instance     = this;
                _sfxSources   = new List <AudioSource>();
                _musicSources = new List <AudioSource>();

                AudioData _data = LoadManager.LoadAudio();
                _musicVol = _data.MusicVol;
                _sfxVol   = _data.SFXVol;
            }
            //too many sound managers
            else if (_instance != this)
            {
                Destroy(gameObject);
            }
        }