- Home /
Change LoadType of an AudioClip at runtime to StreamFromDisc
Hello!
I have this code:
void Start()
{
StartCoroutine(getAudio());
}
IEnumerator getAudio()
{
WWW www = new WWW("file://" + "C:\\Users\\luisc\\Downloads\\Wav\\Blues\\African Plains.wav");
yield return www;
AudioClip audioClip = www.GetAudioClip(false, true, AudioType.WAV);
}
The problem is that it loads the audio in memory. If I have 50 songs, it needs a few Gb of RAM..
I was trying to change the LoadType but it seems that AudioImporterLoadType.StreamFromDisc is deprecated and it don't work because AudioImporter.loadType does not exist anymore..
How can i change this?
PS: Of course i can´t cnage manualy on inspector importer because the audio is on disk and not inside unity project.
Your answer
![](https://koobas.hobune.stream/wayback/20220612064834im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Why WWW.audioClip in unity 3.5 is take much more time to load in comparison with unity 3? 0 Answers
audioclip stream has delay 1 Answer
Loading Audioclip from Resources fails in Build 0 Answers
Where does streamed audio clip stored and removed? 0 Answers
How to wait until everything is loaded before starting? 7 Answers