1
Support / Re: Sprite and Memory Management
« on: January 04, 2013, 04:14:02 am »
I'd like a little more clarification on this...
"All sprite collections, materials and textures are loaded with the sprite animation if they are used in the scene."
First of all, I don't change scenes at all. The entire game is in one Unity "Scene". Instead I'm loading screens all that have their own atlases EXCEPT for the main character which is used through all screens. Each screen is destroyed before the next one is instantiated. Sometimes the main character has a special animation (or more) that is only used in a single screen. I'd like to put that animation in the SCREEN atlas/collection and not the main character animation to save memory. Is this possible? See below for more of a description:
Say I have a SpriteAnimation (Main Character from above) that contains animations using 5 different sprite collections.
I load up my first screen (there are NO scene changes) and I use animations from collections (atlases) 1 and 2 but not collections 3,4 or 5.
Then I close my first screen and open my second (again NO scene changes) and I use animations from collections 1 and 5 but not collections 2,3 or 4.
Third screen 1 and 3 and so on.
If I call Resources.UnloadUnusedAssets() between screen changes, does this keep the unnecessary collection atlases from being loaded into memory for each of my "Screens"? If not is there another way to do what I describe above? Or am I going to have to just throw everything for the "Main Character" into one sprite collection?
Happy New Year and Thanks!
"All sprite collections, materials and textures are loaded with the sprite animation if they are used in the scene."
First of all, I don't change scenes at all. The entire game is in one Unity "Scene". Instead I'm loading screens all that have their own atlases EXCEPT for the main character which is used through all screens. Each screen is destroyed before the next one is instantiated. Sometimes the main character has a special animation (or more) that is only used in a single screen. I'd like to put that animation in the SCREEN atlas/collection and not the main character animation to save memory. Is this possible? See below for more of a description:
Say I have a SpriteAnimation (Main Character from above) that contains animations using 5 different sprite collections.
I load up my first screen (there are NO scene changes) and I use animations from collections (atlases) 1 and 2 but not collections 3,4 or 5.
Then I close my first screen and open my second (again NO scene changes) and I use animations from collections 1 and 5 but not collections 2,3 or 4.
Third screen 1 and 3 and so on.
If I call Resources.UnloadUnusedAssets() between screen changes, does this keep the unnecessary collection atlases from being loaded into memory for each of my "Screens"? If not is there another way to do what I describe above? Or am I going to have to just throw everything for the "Main Character" into one sprite collection?
Happy New Year and Thanks!