Hello Guest

Author Topic: Taking Sprite Collections out of mobile RAM  (Read 4555 times)

ItsMeAlan

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 22
    • View Profile
Taking Sprite Collections out of mobile RAM
« on: March 17, 2014, 12:01:43 am »
We're working on a 2D adventure game for iPhone and Android called Cole. We have so many sprites in our game that it is beginning to affect performance, as it seems every spriteCollection is loaded into RAM at all times, regardless of whether those sprites are used in the scene that is loaded. We're trying to figure out how to stream our assets so only the spriteCollections needed in that scene are loaded into RAM, but we're having a very hard time of it. We're doing a lot of research but haven't gotten much of anymore. We've been using 2dToolKit 1.91 but can upgrade if it'll help us with our asset streaming. Do you have any advice for us?

Thanks!
Alan

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Taking Sprite Collections out of mobile RAM
« Reply #1 on: March 17, 2014, 11:53:21 am »
That isn't right. Sprite collections, associated textures and such are only loaded when something that uses them is in memory.
Unused ones are unloaded when you switch scenes.

How are you working out that they are still resident in memory?

ItsMeAlan

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Taking Sprite Collections out of mobile RAM
« Reply #2 on: March 17, 2014, 09:09:48 pm »
When we built a completely empty scene to mobile, it was still taking up hundreds of MB in RAM. So we looked at our sprite collections and saw there were several that were way too huge, that contained sprites we weren't even using in the game anymore. Once we deleted those spriteCollections from the project, our memory usage went back to normal levels.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Taking Sprite Collections out of mobile RAM
« Reply #3 on: March 17, 2014, 09:12:44 pm »
How did you figure out it was taking up 100s of MB in ram? What tools did you use to work that out?

ItsMeAlan

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Taking Sprite Collections out of mobile RAM
« Reply #4 on: March 17, 2014, 09:26:33 pm »
We used Unity Pro's profiler. It's possible we misinterpreted the information though it seemed straightforward at the time.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Taking Sprite Collections out of mobile RAM
« Reply #5 on: March 17, 2014, 09:29:45 pm »
If all you've loaded is an empty scene, its impossible to have all the assets loaded in memory. Unity only loads stuff when it is referenced by something else.

ItsMeAlan

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: Taking Sprite Collections out of mobile RAM
« Reply #6 on: March 17, 2014, 09:31:32 pm »
Hmm, ok, we'll do some more tests and get back to you!