Hello Guest

Author Topic: does swapping a tk2dSprite's sprite mean you're using twice a much RAM?  (Read 4807 times)

peterbrinson

  • Newbie
  • *
  • Posts: 9
    • View Profile
My scene has 10 GameObjects, each a tk2dSprite.  Each one is based on a unique sprite/image and everything is arranged carefully in the scene editor. 
At scene start, there’s a 50/50 chance I want to swap each of these with a different set of 10 sprite/images. 

I’d like to only load 10 images into memory as they are very wide and tall (png’s). 

- If on ‘Start()’, I swap each of the 10 with different sprite/images, does that mean 20 images are loaded into memory, even for a brief moment? (I'm naive about how unused sprite/images unload, and if they do). 

Btw, these images are mostly set up in sprite collections by themselves because they are so big. 

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
The sprites don't unload unless you destroy all instances of them and call "UnloadTextures" or Resources.UnloadUnusedAssets. As long as there is a reference to something in Unity, it will load in.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Yes.

peterbrinson

  • Newbie
  • *
  • Posts: 9
    • View Profile
I shouldn't have deleted my reply.  I asked if loading a new scene also unloads unused assets.  You can see his reply "Yes" above.