Hello Guest

Author Topic: Sprite Collection refuses to unload from memory  (Read 3250 times)

zaratustra

  • Newbie
  • *
  • Posts: 1
    • View Profile
Sprite Collection refuses to unload from memory
« on: August 04, 2014, 05:18:41 pm »
I have a sprite collection that refuses to unallocate itself from memory once it's there. (Well actually all of them do that, but this one needs to be out.)

Destroying every GameObject that holds a sprite in that collection does nothing.

If I do this, the sprite collection does vanish from memory, but then when I come back to the scene it refuses to load again:

Code: [Select]
MapTileCollection = tk2dSystem.LoadResourceByName<tk2dSpriteCollectionData>("MapTileCollection");
MapTileCollection.UnloadTextures();
MapTileCollection.ResetPlatformData();

I have been butting heads with this for a week and would really appreciate some insight into the situation.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sprite Collection refuses to unload from memory
« Reply #1 on: August 05, 2014, 06:37:21 pm »
UnloadTextures, and ResetPlatformData shouldn't be necessary, if you delete the sprite using it and Load a new level it should unload... Its hard to guess what is going on, different things happen at these stages depending on how everything is set up. I wouldn't use LoadResourceByName as well, unless you're willing to get your hands dirty - that is only officially supported for platform collections, what you're doing if used in conjunction with platform collections could do some nasty stuff...