To create a randomized playlist, you must create an Audio Random Container and then play it in the game.
You can use a randomized playlist to randomize and play almost any sound, such as footsteps, impacts, and AI dialog.
You can create and use a randomized playlist if you know how to do the following:
You can create an Audio Random Container from more than one place.
Note: If you drag an existing Audio Random Container to the Hierarchy, you create a GameObject at the Transform location (0,0,0) with an Audio Source component that references the dragged Audio Random Container.
In the Unity Editor, do the following:
An empty Audio Random Container asset appears in the Project windowA window that shows the contents of your Assets
folder (Project tab) More info
See in Glossary under Assets.
In the Unity Editor, do the following:
An empty Audio Random Container asset appears in the Project window under Assets.
In the Unity Editor, do the following:
An empty Audio Random Container asset appears in the Project window under Assets.
To play an Audio Random Container, you must integrate it with the Audio Source component and then play it, such as with one of the game trigger options.
You can only use the Audio Random Container in conjunction with the Audio Source component. It’s the emitter for the Audio Random Container and determines whether the Audio Random Container has a position in the world or sounds like it doesn’t have a position. For more information, refer to Audio SourceA component which plays back an Audio Clip in the scene to an audio listener or through an audio mixer. More info
See in Glossary.
To integrate, do the following:
You have integrated the Audio Random Container with the Audio Source component. You can play it with the PlayOnAwake bool, the API, or the different game trigger options.
Sounds in games are often triggered by a game event or by a trigger. You can use game triggers, such as buttons, to play the Audio Random Container\:
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.