Hello Guest

Author Topic: Does Application.LoadLevelAsync take 2K2D platform specific atlases into account  (Read 6309 times)

alex.seeck

  • Newbie
  • *
  • Posts: 18
    • View Profile
Hello everyone,

we're building an app where we are loading huge atlases per scene. Loading times shall be covered up by an in between empty scene with an animation.

I wanted to know if the call to Application.LoadLevelAsync is taking the platform specific atlases for the next scene into account?
Are they getting asynchronously loaded?
Are they getting loaded into VRAM?
Right now the animation animates for about 1 second, but the whole loading process until the scene shows up takes about 10 seconds.

Would be nice if you could tell me if you knew what exactly happens on your side of that process and even more if you'd know unity's part, too.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Quote
I wanted to know if the call to Application.LoadLevelAsync is taking the platform specific atlases for the next scene into account?
Platform specific atlases get loaded in Awake on the sprites that use it. Not sure exactly when that happens, it might be before or after LoadLevelAsync returns.

Quote
Are they getting asynchronously loaded?
No its not async, the platform sprite collection asset itself is loaded by reference using Resources.Load.

Quote
Are they getting loaded into VRAM?
As with anything in unity, textures are only uploaded to vram first time its used and visible.


alex.seeck

  • Newbie
  • *
  • Posts: 18
    • View Profile
Thanks for the quick response.

Is a way of using Resources.LoadAsync implemented in 2DToolkit? Or is it possible to manually preload textures before the scene using them is loaded? Right now there seems to be nothing we can do to partially interrupt the loading, or thread it, so we can show something interesting happening to the user while doing so.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
It will be very complicated to make it use LoadAsync. However, it might be possible to preload the textures - you'd need to know the textures that need to be loaded per sprite collection platform / per scene. You can work that out in an editor script and save it in some global list somewhere - Dictionary(sceneName + platformName, List(TextureGUIDStrings)); Easiest way I can think of to work this out is to write an editor script to load each level in your game, find all sprites, build a set of sprite collection datas, and for each collection, catalog the spriteCollectionPlatformGUIDs. You can then preload all of these before loading the level itself, maybe using a custom version of tk2dSystem.LoadResourceByGUIDImpl that uses LoadResourceAsync. Remember though, if you use PNG atlases you're pretty much out of luck, the png loading function isn't async.

alex.seeck

  • Newbie
  • *
  • Posts: 18
    • View Profile
Thank you very much for your insights and thoughts

alex.seeck

  • Newbie
  • *
  • Posts: 18
    • View Profile
It has been quite a while now since I asked the last time. Has anything changed on that matter? Has some mechanism been implemented for loading textures async before the scene needing them is loaded?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Hi there,
Nothing has been implemented for this - its a ton of effort to implement this in a robust way and even then there will be a ton of edge cases where it fails. I don't plan to implement this any time soon.