void UpdateSound() { foreach (ClipSound sound in sounds) { sound.source = gameObject.AddComponent <AudioSource>(); sound.source.clip = sound.clip; sound.source.volume = sound.volume * SettingsScript.GetSoundEntry(); sound.source.pitch = sound.pitch; sound.source.loop = sound.loop; } }
// Start is called before the first frame update void Start() { lb.SetActive(false); shop.SetActive(false); options.SetActive(false); //Debug.Log("I: " + PlayerPrefs.GetString("items")); // Debug.Log("B: " + PlayerPrefs.GetString("bought")); FindObjectOfType <AudioManager>().Play("Stargazing"); GameObject.Find("Main Camera").GetComponent <AudioSource>().volume = SettingsScript.GetSoundEntry(); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); foreach (ClipSound sound in sounds) { sound.source = gameObject.AddComponent <AudioSource>(); sound.source.clip = sound.clip; sound.source.volume = sound.volume * SettingsScript.GetSoundEntry(); sound.source.pitch = sound.pitch; sound.source.loop = sound.loop; } }
void UpdateSound() { GameObject camera = GameObject.Find("Main Camera"); camera.GetComponent <AudioSource>().volume *= SettingsScript.GetSoundEntry(); }