- Home /
Question by
rok-kompan · Mar 06, 2015 at 01:10 PM ·
unity 5audio
Will there be an event system in the new audio in Unity 5
The fancy mix controls, dandy routing, effects etc all sounds great. But what about some basic event system like like playing random sound of a group of clips, random pitch/volume of one sound, loop crossfades etc?
I can't find that info anywhere.
Comment
Answer by tanoshimi · Mar 06, 2015 at 01:15 PM
Unless I'm mistaken, you play random sounds from an array at random pitch/volumes in Unity 5 exactly the same way as you did in Unity 4. i.e.
// Pick a random clip from an array
public AudioClip[] audioClips;
audioSource.clip = Random.Range (0, audioClips.Length);
// At a random pitch
audioSource.pitch = Random.Range(0.95f, 1.05f);
audioSource.Play();