I have a WebGL project in Unity 2022.2.x using Addressables and Localization packages. It works perfectly if I run it in the editor, but if I “build and run” to see it in a browser, the following well-known error occurs:
Exception: WebGLPlayer does not support synchronous Addressable loading. Please do not use WaitForCompletion on the WebGLPlayer platform.
at UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].WaitForCompletion () [0x00000] in <00000000000000000000000000000000>:0
The error is a common situation and covered in the Addressables documentation:
Synchronous Workflow | Addressables | 1.20.5.
Unfortunately, I’ve scanned every line of my code, and I’m not calling the WaitForCompletion method anywhere. I’ve checked all my AddressableGroups and project settings, and nothing is configured for synchronous loading.
The app was working correctly in a browser, with Addressables, until I added Localization into the project. So I think Localization has an internal usage of WaitForCompletion, but I can’t seem to find it. Even with a “development build”, the developer console in the web browser isn’t much help in debugging, because when the exception occurs, the call stack has only several levels of the error reporting from the Unity framework and then when it gets to the application’s own code, everything is in a primitive intermediate assembler-like format with no meaningful references to C# methods.
There are multiple threads regarding this error that suggest setting the localization string tables to be preloaded, which would be fine for this small app, but in the Addressable Groups window everything related to localization is greyed out and not editable. (Along that subject line, the Unity documentation on the Addressable Groups window actually shows a lot of the assets greyed out in its screen shot, but it does not explain what this means or why it is so. I’d appreciate any guidance to understand this, because an online search didn’t yield any useful hits for me.)
Is there a way to run the WebGL app from “Build and Run” but have it send data back to the Unity editor? I know how to connect the Profiler to the app, but that’s not providing any helpful info for debugging.