private void Start() { AudioSetting audioSetting = new AudioSetting(); audioSetting.Load(); GameDataManager.instance.gameData.optionData.audioSetting = audioSetting; }
void Awake() { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); library = GetComponent <SoundLibrary>(); musicSources = new AudioSource[2]; for (int i = 0; i < 2; i++) { GameObject newMusicSource = new GameObject("Music source " + (i + 1)); musicSources[i] = newMusicSource.AddComponent <AudioSource>(); newMusicSource.transform.parent = transform; } GameObject newSfx2Dsource = new GameObject("2D sfx source"); sfx2DSource = newSfx2Dsource.AddComponent <AudioSource>(); newSfx2Dsource.transform.parent = transform; audioListener = FindObjectOfType <AudioListener>().transform; AudioSetting audioSetting = new AudioSetting(); audioSetting.Load(); masterVolumePercent = audioSetting.masterVolumePercent; musicVolumePercent = audioSetting.musicVolumePercent; sfxVolumePercent = audioSetting.sfxVolumePercent; } }
public void Load() { audioSetting.Load(); }