- Home /
calling www to get audio.clip multiple times causes memory problems
I download a wav sound then load it with www. Then if I download another the memory is still being used by the first one (this is on the iphone -- I'm watching the memory profile of the app)
How do I clear the memory or variables (delete? destroy) to free up the memory each time I download a new sound? What are the general rules for deleting things in variables if they are going to be used multiple times?
Thanks,
Here's the code that I call multiple times which causes the memory accumulation.
function getAudio1(){
var mp3WWW = new WWW(path_to_sound_file);
display="loading clip";
yield mp3WWW;
var myclip=mp3WWW.GetAudioClip(false);
audio.clip=myclip;
audio.ignoreListenerVolume =true;
audio.pitch=1;
audio.Play();
display="loaded";
}
Answer by revocelotmoky · Nov 18, 2015 at 10:37 PM
HI, this post is a little old but, yes there's a way, you have to call the function Resources.UnloadUnusedAssets(); each time you change the path to load in the www object. :)
Your answer
Follow this Question
Related Questions
Best way to play and delete many audio files 0 Answers
When is audio file loaded to memory 0 Answers
Memory management theory question 1 Answer