Localised sprite assets cause WebGL build to freeze

This is probably something I am doing wrong, but if I add a sprite to a scene, localise the component and then run the game in a WebGL build, the browser freezes as the WebGL game loads (around 90%).

I’ve tried compressing the sprites but this doesn’t seem to make any difference, as well as creating the build in all the various Unity versions available and getting the same issue.

7255160--874721--upload_2021-6-20_21-13-31.png

If I disable this component, the game starts up fine so maybe it’s something up with the LocalizeSpriteEvent script?

Could someone please confirm if this is working or if it is something on my computer?

What version of Unity are you using?
Is there any errors in the log file?

It works fine in the editor, and in the standalone Windows build.

I have tried in Unity versions 2019.4.28, 2021.1.12f, 2021.2.0a21 (basically been trying as they have been getting released).

No errors in the DevTools console, not sure if WebGL has a log file?

I can make a quick sample project if it helps.

Here’s a sample project made in 2021.1.12f.

7255256–874760–WebGL-Localization-Sample.zip (505 KB)

Im not really sure what’s going on. WebGL is not a nice platform to debug on so its going to take me some time to figure it out. I have created a bug report Unity Issue Tracker - WebGL build freezes loading Localization Sprite Data

1 Like

Were you able to replicate the issue?

Yes but couldn’t see why it was happening, it will require debugging.

Thanks for confirming, my sanity appreciates it!

Do you know when that issue tracker link will go live?

Try now. I missed a field out so it did not sync, should work now.

The issue is marked as Won’t Fix, mentioning that WaitForCompletion should not be used for WebGL. Would it be possible to mark with a warning or disable options that would break the build? Should probably save a lot of time for other users in the future

I’ve spent quite some time before finding this thread, here is how I fixed it for anyone interested:

  • Disable Initialize Synchronously option of Localization Settings (should be easy to restrict for WebGL for sure) - this results in an internal WaitForCompletion call
  • Avoid calling WaitForCompletion in own code, for example, don’t use LocalizedStringTable.GetTable(). This one is probably on Addressables to throw a warning
1 Like

Addressables will throw an error in the latest version and we have made changes to ignore wait for completion on web gl in the next release.

1 Like