Hello Guest

Author Topic: tk2d animated sprites occasionally invisible on WebGL build  (Read 5414 times)

csumsky3

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
    • www.moonlightkids.co
tk2d animated sprites occasionally invisible on WebGL build
« on: January 19, 2017, 06:36:13 pm »
Hello!

So this issue is really hard to track down, so mostly I'm just wondering if anyone's seen it before.

First, some background. I have a 20-Level game, each level a separate scene, each utilizing tk2d's TileMap to build out the levels. Player Character, Enemies, and everything else gameplay-related is atlased, animated and rendered via tk2d (UI is handled through Unity's UI system, and the sprites are thus not going through tk2d, but UI really has nothing to do with this issue, so I don't think that info is that relevant).

Ok so the issue. When I'm playing the WebGL build that's staged on a server, running in a browser (I mainly test on Chrome, so that's all I've confirmed it happening in so far), after I've been playing the game for a long time, some animated enemy sprites will suddenly be invisible when the scene loads. They're still be there, attacking me and colliding with me, but the sprites just don't show. I don't think it's a layering or sorting issue, as the issue is random and the same enemies that were showing fine a playthrough before will now be invisible. Also, once I start seeing invisible enemies, if I die and respawn (which reloads the scene), the player character will now be invisible as well. Once the issue starts showing, the only way I can fix it is by refreshing the page from the browser - switching / reloading scenes doesn't fix it. One thing to note is that it only seems to happen with animated sprites.

If I inspect the browser once the issue starts, the console isn't that helpful. But I'll be sure to follow up if I see anything that might be useful (I'm about to start another playthrough to test for the issue). Anyhow, quite a weird one! Any insight or help would be greatly appreciated!

Cheers

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2d animated sprites occasionally invisible on WebGL build
« Reply #1 on: January 26, 2017, 10:58:43 pm »
Hi there,

I haven't got many ideas around this - except adding some debug code in the project to rebuild all sprites and see if that changes anything? Unity WebGL is really hard to debug :(

It also could just be a bug in Unity WebGL...

csumsky3

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 14
    • View Profile
    • www.moonlightkids.co
Re: tk2d animated sprites occasionally invisible on WebGL build
« Reply #2 on: January 26, 2017, 11:33:26 pm »
Quote
Unity WebGL is really hard to debug :(
So very true!

Quote
It also could just be a bug in Unity WebGL...
Yep definitely something I haven't ruled out... I just had my fingers crossed that you'd seen it before ;)

We'll keep looking. The idea to rebuild all sprites from code is interesting... how would I go about doing that? Perhaps if I rebuild on every level load it might prevent this... a total shot in the dark though, haha.