- Home /
How to save referenced asset to regular file?
Hi,
I'm loading sound, .wav file, from AssetBundle. Load is successful, I get a reference to AudioClip file, and I can play that sound through AudioSource. My problem is, that I want to save that referenced clip into regular .wav file in project. Does anyone knows anything about it?
Thanks in advance :)
Answer by Bunny83 · Aug 12, 2020 at 11:17 PM
You can not have a wav file inside an assetbundle unless you save it as TextAsset. If you imported the wav file into Unity and created an assetbundle from the imported audioclip it would be stored as ogg internally. However an AudioClip is an asset representation and you don't really have access to the raw data. However since wav is a relatively simple audio format it's quite trivial to generate the wav header and convert the samples of the AudioClip into 16 integer samples. There are several scripts out there in the wild that do this for you. One of them is this one
Your answer
Follow this Question
Related Questions
Importing A Bolt Flow 0 Answers
Loading Script from Asset Bundle in iOS and WebGL. 2 Answers
Asset Bundle with script ? 0 Answers
How to play multiple audio files from one script 1 Answer
Sound file question 1 Answer