/// <summary> /// Adds a sound with a single variation to the sound bank. /// </summary> /// <param name="name">Name of the sound.</param> /// <param name="clip">A reference to the audio clip with audio data.</param> /// <returns> /// A reference to a newly created sound. /// </returns> public Sound AddSound(string name, AudioClip clip) { Sound sound = new Sound(this, name); sound.Bus = DefaultBus; sound.AddVariation(clip); sounds.Add(sound); runtime.AddSound(sound); return(sound); }
/// <summary> /// Adds a sound with multiple variations to the sound bank. /// </summary> /// <param name="name">Name of the sound.</param> /// <param name="clips">An array of audio clips with audio data.</param> /// <returns> /// A reference to a newly created sound. /// </returns> public Sound AddSound(string name, AudioClip[] clips) { Sound sound = new Sound(this, name); sound.Bus = DefaultBus; if (clips != null) { for (int i = 0; i < clips.Length; i++) { if (clips[i] == null) { continue; } sound.AddVariation(clips[i]); } } sounds.Add(sound); runtime.AddSound(sound); return(sound); }