Hello Guest

Author Topic: PNG atlas format issue on WinPhone  (Read 4961 times)

MeowMeat

  • Newbie
  • *
  • Posts: 2
    • View Profile
PNG atlas format issue on WinPhone
« on: December 23, 2014, 08:58:52 am »
We have our atlases in PNG format (for app size reducing).
On WinPhone 8 after application resuming sprites are broken (see the screenshots attached). That’s enough to turn off and then turn on again phone’s screen, or go to the menu and then back to game to get them broken.

After another scene loading or the current scene reloading everything become ok.

There are no such problems on iOS or Android. But something pretty similar we have been observing while switching platform (1x/2x) at runtime by our own controllers (for dev purposes) - we’ve solved it by scene reload.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: PNG atlas format issue on WinPhone
« Reply #1 on: December 23, 2014, 10:42:03 am »
Runtime platform switching isn't supported really, the whole system isn't designed for that.
Regarding the issue in WinPhone8,  if you can detect when the device is going to be lost / reset, then find all tk2dSpriteCollectionDatas, and call ResetPlatformData on them. When it recovers, run through all sprites and call ForceBuild() on them, that should force a reload. It looks like Unity isn't behaving itself and isn't restoring the textures on that platform.

zzdjk6

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 7
    • View Profile
Re: PNG atlas format issue on WinPhone
« Reply #2 on: December 26, 2014, 03:05:14 pm »
I encounter the same problem when resume from pause using PNG atlas on windows phone 8.

I have to change to use Unity Texture... :(

MeowMeat

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: PNG atlas format issue on WinPhone
« Reply #3 on: December 27, 2014, 01:38:38 pm »
I encounter the same problem when resume from pause using PNG atlas on windows phone 8.

I have to change to use Unity Texture... :(

We have fixed that right as unikronsoftware said: ResetPlatformData() for all the tk2dSpriteCollectionData and ForceBuild() for all the tk2dBaseSprite objects. We use OnApplicationPause() method as a coroutine and launch a loader while rebuilding sprites (that's not so fast).

Also we needed some small fix in tk2dSpriteCollectionData.DestroyTextureInsts() - check for a null reference, as it was causing exception sometimes.