I'm developing an iOS app with Unity where I load textures at runtime from the file system. I only have one scene. The piece of code I use to load the textures is shown below. This is called several times during runtime if the user wishes to change these so called 'backTextures'.
In my tests I call this several times in a row. Everything goes well and afaik there is no sign of memory leaks. But after executing this several random times (say as little as 2 times or even as much as 13 times for example) Unity hangs.
According to the Xcode console, the last print I read is the 'Just created the www' so I am assuming the script is hanging waiting for the 'yield return _www;'. This happens always on the first iteration of the for loop (i=0), but as I said before, after calling this piece of code several times.
Can anyone help me out with this? I have no idea why yield return www would hang...
**EDIT** I did some more testing: This code is running on a coroutine. I added a print to the Update() and it keeps being called. So the Unity engine is not completely dead. It really seems that it is the www that is not returning....
//some code before
if(backTextures != null && backTextures.Length != 0){
Debug.Log("Cleaning the vector!!!!");
for(int i = 0; i < backTextures.Length; i++){
Destroy(backTextures[i]);
backTextures[i] = null;
}
}
//Some more code here
Debug.Log("Will load " + picsize + " textures");
//load textures to memory
for(int i=0; i
↧