// Start is called before the first frame update void Start() { if (VolumeSlider == null) { return; } VolumeSlider.value = PlayerPrefs.GetFloat("Volume", 1); aMan = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <D_AudioManager>(); }
private void Awake() { if (current == null) { current = this; } else { Destroy(this.gameObject); return; } DontDestroyOnLoad(this.gameObject); foreach (D_Sound s in sounds) { s.source = gameObject.AddComponent <AudioSource>(); s.source.clip = s.clip; s.source.volume = PlayerPrefs.GetFloat("Volume", 1); s.source.pitch = s.pitch; s.source.loop = s.loop; s.source.playOnAwake = false; sources.Add(s.source); } }
private void OnEnable() { VolumeSlider.value = PlayerPrefs.GetFloat("Volume", 1f); aMan = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <D_AudioManager>(); }