//private GameObject existentCrossSceneButtonController; // Start is called before the first frame update private void Awake() { Screen.fullScreen = true; if (!MessageSender.GetWhetherExist()) { messageSender = Resources.Load <GameObject>("Prefabs/CrossSceneMessageSender"); existentCrossSceneMessageSender = Instantiate(messageSender, transform.position, transform.rotation) as GameObject; existentCrossSceneMessageSender.name = messageSender.name; } if (!BKMusicPlayer.GetWhetherExist()) { bKMusicController = Resources.Load <GameObject>("Prefabs/CrossSceneBKMusicController"); existentCrossSceneBKMusicController = Instantiate(bKMusicController, transform.position, transform.rotation) as GameObject; existentCrossSceneBKMusicController.name = bKMusicController.name; } if (!ButtonSoundPlayer.GetWhetherExist()) { buttonSoundController = Resources.Load <GameObject>("Prefabs/CrossSceneButtonSoundController"); existentCrossSceneButtonSoundController = Instantiate(buttonSoundController, transform.position, transform.rotation) as GameObject; existentCrossSceneButtonSoundController.name = buttonSoundController.name; } /* * if (!ButtonController.whetherExist) * { * existentCrossSceneButtonController= Instantiate(buttonController, transform.position, transform.rotation) as GameObject; * existentCrossSceneButtonController.name = buttonController.name; * } */ }
//*************************************************************************** //生命周期 private void Awake() { BKMusicPlayer.whetherExist = true; BKMusicPlayer.theExistentBKMusicController = this.gameObject; audioSourceOfBKMusic = BKMusicPlayer.theExistentBKMusicController.GetComponent <AudioSource>(); BKMusicPlayer.theInstance = this; DontDestroyOnLoad(this.gameObject); }
public void SetBKMusicVolume() { BKMusicPlayer.GetTheInstance().SetVolume(slider.value); }
private void Awake() { slider = GetComponent <Slider>(); slider.value = BKMusicPlayer.GetTheInstance().GetVolume(); }