ReferenceError: Runtime is not defined at WebSocket.instance.ws.onmessage

Unity WebGL build using Unity Transport 2.0.2 and WebSockets throws this error when trying to connect via Relay. Not sure it’s a Unity Transport bug, maybe a WebSocket library it uses under the hood?

I was able to fix it by replacing all the lines using Runtime.dynCall in framework.js with Module like this:

Am I missing some package upgrade in order to not fix this manually every time?

Is it possible that you have the WebSocket community transport installed and are using that instead of Unity Transport? Because that line is not in the code supporting WebSockets in Unity Transport.

To use WebSocket support provided by Unity Transport 2.0, make sure “Unity Transport” is selected as the network transport in your Network Manager, and then check the “Use WebSockets” checkbox under the Unity Transport component. There is no need to install the community WebSocket transport.

1 Like

Thanks! I believe the problem got solved after either updating Multiplayer Tools package to 1.1.0 or Wire package to 1.1.8. I definitely wasn’t using WebSocket community transport before, but maybe one of the other packages were.