I have an update loop on the iphone that adds a texture to an array every .1 seconds. After the array fills up I want to destroy it and start over. I seem to be unable to destroy the texture2d array because memory on the iphone accumulates quickly and crashes the app. So how would I destroy these textures. I tried destroying them in a for loop var textures=new Texture2D; //textures are put in each .1 seconds until full.
but that doesn't seem to work. Could someone explain the best way to destroy and delete the memory associated with a texture2d if it's by itself or in an array?
asked May 09 '12 at 04:26 AM
Destroying Unity objects won't have any effect on memory, since they aren't part of Mono and aren't subject to garbage collection. You can use Resources.UnloadUnusedAssets. Also Unity objects are cleaned up when loading a new level.
answered May 09 '12 at 05:56 AM