So I’m working in Unity Iphone 1.5, and seem to be having this odd problem.
The app: In my app, you start on a menu which is my entry scene, one of the options is to go to a scene where it loads a binary file from the web, parses it out and recreates a scene of objects from the data. All objects in one of these scenes are asset bundles, so it takes a bit to load, but works.
Now for the problem: When I moved all of this to the iphone - it works the first time, loads the bin, creates the scene everything is spiffy. If I leave that scene and go back to my main menu, then go back to that scene, it reloads the bin, recreates the scene, but for some reason, all the objects it instantiated from the first run are still there! I am not using DontDestroyOnLoad, I tried using Application.GarbageCollectUnusedAssets() and I even went as far as destroying the game objects by hand by iterating through my array upon clicking the done button from that scene. Again, this works on mac, but on Iphone it doesn’t want to kill those objects? HOW DO I KILL THEM?
This is some kind of editor problem only I think
Ran into this too and already filed a bug report.
Destroy will not remove them at all in the editor, DestroyImmediate is kind of russian roulette on each called object if it will die or not
Thanks for the quick reply - actually, in the editor as I jump between scenes it is fine, sorry I should have been more specific. This problem comes up when I run it on the actual iphone device. While it seems to be fine in the editor, I just noticed some “errors” that I forgot I had because I found out they were actually warnings. They say “Deleting persistent object without writing it first: library/unity default resources
UnityEngine.Application:GarbageCollectUnusedAssets() (at /Users/build/builds/unity-iphone/iphone/Runtime/Export/Generated/BaseClass.cs:1258)”
Starting to think that has something to do with it. But if I remember from my research when I first started getting those, I was told to basically ignore them, and that they were just warnings, when I asked how to get rid of them no one could tell me.
So it wasn’t related to the “Error,” I really can ignore that. It was in my code, really hard to find. What made it difficult to debug was that the problem was not happening on the mac through the editor for some reason and only on the device, I still can’t figure out why it didn’t happen in the editor though. Anyways, this is solved.