Add Group
What it does: Adds the given AudioMixerGroup to the given sound and returns an AudioError (see Possible Errors), showing wheter and how adding the group failed.
- DOES_NOT_EXIST
- MISSING_WRAPPER
- MISSING_SOURCE
- MISSING_CLIP
How to call it:
SoundNameis thenamewe have given the sound we want to add theAudioMixerGrouponMixerGroupis theAudioMixerGroupsettings the sound should be influenced byChildis theChildTypethat we want to call this method on
string soundName = "SoundName";
AudioMixerGroup mixerGroup = null;
ChildType child = ChildType.PARENT;
AudioError error = am.AddGroup(soundName, mixerGroup, child);
if (error != AudioError.OK) {
Debug.Log("Adding AudioMixerGroup on the sound called: " + soundName + " failed with error id: " + err);
}
else {
Debug.Log("Adding AudioMixerGroup on the sound called: " + soundName + " succesfull");
}
Alternatively you can call the methods with less paramters as some of them have default arguments.
string soundName = "SoundName";
AudioMixerGroup mixerGroup = null;
AudioError error = am.AddGroup(soundName, mixerGroup);
if (error != AudioError.OK) {
Debug.Log("Adding AudioMixerGroup on the sound called: " + soundName + " failed with error id: " + err);
}
else {
Debug.Log("Adding AudioMixerGroup on the sound called: " + soundName + " succesfull");
}
When to use it: When you want to add the influence and settings of a AudioMixerGroup from a sound. A sound can only ever be influenced by one AudioMixerGroup at a time.