- Home /
garbage collection not cleaning up material that isn't referenced on android
I have a game with two scenes, menu and game. When jumping from the scene menu to game on Android one of the textures used in menu isn’t removed from memory. However, this problem does not appear when doing the same thing in the editor. When using the memory profiler on the Android I can see that the texture has one reference to one material but that material itself does not have any references.
This is a big problem for me as this texture is the largest one in the game (NGUI atlas for the menus). When the memory gets full I get a big spike due to garbage collection but the texture is still not being removed.
Only thing I can think of is that the material might be referenced in a static variable by the NGUI plugin and maybe that’s why it doesn’t show any references?
Any other ideas? Or ideas for solution or workaround?
Answer by mrdoktor1974 · Aug 30, 2013 at 01:01 PM
Ok, found the solution. It had something to do with NGUI. Either references or hidden geometry. I just disabled the gameobject with the NGUI root before jumping to the next scene and now it works!