2D Toolkit Forum

2D Toolkit => Support => Topic started by: Maserat on April 17, 2013, 01:31:36 am

Title: Unload Resources and AssetBundles
Post by: Maserat on April 17, 2013, 01:31:36 am
If I create a prefab of animated sprites and textures, and instantiate it from Instantiate( Resource.Load( prefab ) ). How do I remove all the dependencies ie textures from memory? How do I do the same thing with assetbundle after I instantiate( www.assetbundle.mainAsset ) as GameObject?

I currently have:

tk2dResource.Destroy( lepsrite );
Destroy( lesprite.gameObject );
lesprite = null;

When I profile an iOS device, I seem to be leaving some textures in memory. What am I doing wrong?

Thanks            
Title: Re: Unload Resources and AssetBundles
Post by: unikronsoftware on April 17, 2013, 09:40:23 am
Have you Resources.UnloadUnusedAssets yet? This should unload all other unused dependencies. FWIW, there will be a tk2dSpriteCollection.Unload function in 2.0 - this will explicitly unload the texture(s) and material(s).