One Slider Control More Than One Sound

I want to ask. how to make 1 slider control more than 1 sound? when i make AudioSource to array AudioSource to put 3 sound, the error said that “SFXVolume.Volume” does not contain a definition of volume.

public Slider SFXSlider;
public AudioSource SFXVolume;
public float SFX;
// Use this for initialization
void Start () {
	SFXSlider.value=PlayerPrefs.GetFloat ("SFXMusic");
	LoadSFX ();
	SFXVolume.volume = SFX;

// Update is called once per frame
void Update () {
	SFXVolume.volume = SFXSlider.value;
public void saveMusic(){
	PlayerPrefs.SetFloat ("SFXMusic",SFXSlider.value);
void LoadSFX(){
	if (PlayerPrefs.HasKey("SFXMusic")) {
		SFX = PlayerPrefs.GetFloat("SFXMusic");
	} else {
		SFX = 1;

Sorry for my bad english and thanks before :slight_smile:

If I understand correctly, your code with the array had

 public AudioSource[] SFXVolume;

instead of

 public AudioSource SFXVolume;

In this case, SFXVolumeis no longer an AudioSource but an array of AudioSources. When you tried to access volume, it said that an array does not have a definition for volume, which is correct. Arrays don’t have volumes. What you need to do is access each AudioSource within the array by iterating through the array and modifying each one.

foreach(AudioSource eachSource in SFXVolume){ //where SFXVolume is an AudioSource[]
    eachSource.volume = SFXSlider.value;

I may have not correctly understood what you said, please correct me if I am wrong.

Your English is fine by the way :slight_smile: