void Start() { volume.value = PlayerPrefsManager.GetMasterVolume(); difficulty.value = PlayerPrefsManager.GetDifficulty(); m = GameObject.FindObjectOfType <musicmanager>(); l = GameObject.FindObjectOfType <LevelManager>(); }
// Use this for initialization void Start() { m = GameObject.FindObjectOfType <musicmanager>(); if (m) { float volume = PlayerPrefsManager.GetMasterVolume(); } }
//PlayerPrefs Int "backgroundMusic" 1(clip_1), 2(clip_2), 3(clip_3) are main music options, //0, 4, 5 are null slots, 6(clip_4) is full threnody, 7(clip_5) is ancilla tone, //8(clip_6) is harbinger tone void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
/// <summary> /// Awake is not public because other scripts have no reason to call it directly, /// only the Unity runtime does (and it can call protected and private methods). /// It is protected virtual so that possible subclasses may perform more specific /// tasks in their own Awake and still call this base method (It's like constructors /// in object-oriented languages but compatible with Unity's component-based stuff. /// </summary> protected virtual void Awake() { // Singleton enforcement if (instance == null) { // Register as singleton if first instance = this; DontDestroyOnLoad(this); } else { // Self-destruct if another instance exists Destroy(this); return; } }
// Use this for initialization void Start() { musicManager = GameObject.FindObjectOfType <musicmanager>(); volume.value = player_prefManager.GetMasterVolume(); difficulty.value = player_prefManager.GetDifficulty(); }