Remove Sound

What it does: Deregisters and deletes the underlying AudioSource component of a sound with the AudioManager so it can’t be played anymore and returns an AudioError (see Possible Errors), showing wheter and how removing the sound failed.

Possible Errors:

  • DOES_NOT_EXIST

How to call it:

  • SoundName is the name we have given the sound we want to remove
string soundName = "SoundName";

AudioError err = am.RemoveSound(soundName);
if (err != AudioError.OK) {
    Debug.Log("Removing sound called: " + soundName + " failed with error id: " + err);
}
else {
    Debug.Log("Removing sound called: " + soundName + " succesfull");
}

When to use it: When you want to remove a sound, because it will not be called anymore. Also deletes the underlying AudioSource component.