WebGL WebAssembly freezes on SceneManager.LoadScene(...)

Hi,

I’m working on my personal project and I have a few calls to SceneManager.LoadScene(…) and the game just freezes (crashes) after I want to load some scene.

I think maybe it’s because I have a few methods that do async operation:

private async void OnDestroy()
{
       if (webSocket != null)
       {
           await webSocket.Close();
       }
}

Is it can be because of that? if yes, can someone please explain me why? Unity engine shouldn’t take care of it?

Unity version: 2020.2.1f1

Thanks,
Ben

So I found the issue, the issue is the NativeWebSocket library that I’m using throws an exception when websocket.Close() called and the connection was already closed, and in a result of that WebGL crashed.

Anyways, I’d like to know if async/await is possible today on WebGL or will be possible in the future, thanks! :slight_smile: