Hello, I’m playing around with the AudioRandomContainer and it’s a nice asset for setting up AudioClip[] within its own asset container, which makes organizing audio files much easier, but there’s a huge downside in that I can’t get or set any of the values from this asset once I’m in runtime.
The idea is that I want to use it as a way of sorting my audioclips into collections (compared to creating arrays of audioclips inside a AudioManager singleton for example), and then have my own code either set the audiosource.resource to it, or to get a specific value from it and do something else with it. For example, I want to call a PlayOneShot, which means I need to get a random audioclip from inside the AudioRandomContainer. I would also want to change the pitch and volume at runtime as well, but there’s no public methods or properties for me to change.
Since AudioRandomContainer apparently has no option to change any of its data once it’s set in the editor, it ends up being mostly useless, and I had to resort to creating a ScriptableObject with effectively the same properties, because I can modify and read properties from it.
1 Like
Hey, sorry for the late reply. I agree with all the limitations you state, it was a conscious choice from us here on the audio team to ship the AudioRandomContainer in a timely manner. We had hoped to bring some API updates after looking at how people use this feature, but sadly we have had to focus on other areas.
(there are some internal methods you might be able to get access to with reflection/assembly definitions (containerActivePlayables). but you didnt hear it from me)
1 Like