I’d like to load an AudioClip from data I’ve extracted into a byte[ ] from a zip file. But the only way I can find to load WAV data at runtime is UnityWebRequestMultimedia.GetAudioClip, which won’t work here since I don’t have a URL.
Is there any way to do this, short of looking up the WAV format and decoding it myself?
The first idea that comes into my mind is implementing OnAudioFilterRead in a behavior script (docs with example: Unity - Scripting API: MonoBehaviour.OnAudioFilterRead(float[], int)). You just write your bytes into the float array (scale it to -1.0 to 1.0 first) and this should work. Note that this requires an AudioSource component to be present, so you probably need a small sound that is constantly played and overwritten with your audio.