public override void Initialize() { hashed = new Dictionary <string, AudioEntity>(); for (int i = 0; i < clips.Length; i++) { AudioEntity clip = clips[i]; if (clip.clip) { hashed.Add(clip.clip.name, clip); } } }
public void PlayRandom(GameObject obj) { if (clips.Length == 0) { Debug.LogWarning($"RandomCLips {name} in {obj.name} has no clips"); return; } AudioEntity ae = clips.Length == 1 ? clips[0] : Randomf.Element(clips); if (!ae.clip) { Debug.LogWarning($"Random AudioEntity in {obj.name} is missing a clip"); return; } ae.Play(obj); }