I have this function to handle my paused game but when I try to add the playing sounds too the playingSoundsArray with playingSoundsArray.Add(sound) I get a console compile error: "Add’ is not a member of ‘UnityEngine.AudioSource[ ]’.
function PauseMenuCall()
{
if(singleplay)
{
var playingSoundsArray :AudioSource[];
if(!pauseMenuToggle)
{
// Make the pause text pop up and stop time.
pauseMenuToggle = true;
Time.timeScale = 0 ;
// Next pause all running audio clips and add them to the playingsounds array so we can enable them again later.
var allSounds :AudioSource[]= FindObjectsOfType(AudioSource);
for (var sound : AudioSource in allSounds)
{
if(sound.isPlaying)
{
playingSoundsArray.Add(sound);
sound.Pause();
}
}
}
else
{
pauseMenuToggle = false;
Time.timeScale = 1 ;
AudioListener.volume = oldVolume;
rMainCamera.EnableCamControl();
for (var playingsound : AudioSource in playingSoundsArray)
{
playingsound.Play();
}
}
}
}