public void SetupAudioSource(AudioSource source, string key) { if (_lookup.ContainsKey(key)) { AudioLibraryItem item = _lookup[key]; if (item.mixerGroup != null) { source.outputAudioMixerGroup = item.mixerGroup; } source.clip = item.GetClip(); source.volume = item.volumeScale; } }
public void OnAfterDeserialize() { _lookup = new Dictionary <string, AudioLibraryItem>(); int i = 0, l = _items.Length; for (; i < l; ++i) { AudioLibraryItem item = _items[i]; if (!_lookup.ContainsKey(item.key)) { _lookup.Add(item.key, item); } } }