Hello Guest

Author Topic: Unload Resources and AssetBundles  (Read 4266 times)

Maserat

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 10
    • View Profile
Unload Resources and AssetBundles
« 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            

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Unload Resources and AssetBundles
« Reply #1 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).