protected override void Awake() { base.isDontDestroy = true; base.Awake(); LoadVolume(); SceneManager.sceneUnloaded += OnSceneUnloaded; for (int i = 0; i < m_sePlayerNum; i++) { GameObject soundPlayerObj = new GameObject("SoundPlayer" + i.ToString("0")); soundPlayerObj.transform.SetParent(transform); SoundEffectPlayer player = soundPlayerObj.AddComponent <SoundEffectPlayer>(); player.Init(); m_soundEffectPlayers.Add(player); } GameObject mainBackgroundPlayerObj = new GameObject("MainBackgroundMusicPlayer"); GameObject subBackgroundPlayerObj = new GameObject("SubBackgroundMusicPlayer"); mainBackgroundPlayerObj.transform.SetParent(transform); subBackgroundPlayerObj.transform.SetParent(transform); m_mainBackgroundPlayer = mainBackgroundPlayerObj.AddComponent <BackGroundMusicPlayer>(); m_subBackgroundPlayer = subBackgroundPlayerObj.AddComponent <BackGroundMusicPlayer>(); //初期化 m_mainBackgroundPlayer.Init(); m_subBackgroundPlayer.Init(); //Dictionaryに追加 for (int i = 0; i < audioClipListSe.Count; i++) { m_audioClipDictSe.Add(audioClipListSe[i].name, audioClipListSe[i]); } for (int i = 0; i < audioClipListBgm.Count; i++) { m_audioClipDirtBgm.Add(audioClipListBgm[i].name, audioClipListBgm[i]); } }