Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

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

Discussion in 'Unity Transport' started by tjumma, Jun 13, 2023.

  1. tjumma

    tjumma

    Joined:
    Sep 30, 2019
    Posts:
    12
    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:

    upload_2023-6-13_22-30-45.png

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

    Attached Files:

  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    441
    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.
     
    tjumma likes this.
  3. tjumma

    tjumma

    Joined:
    Sep 30, 2019
    Posts:
    12
    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.