multiplayer-community-contributions icon indicating copy to clipboard operation
multiplayer-community-contributions copied to clipboard

Netcode for GameObjects Web Socket WebGL build error

Open Ripper53 opened this issue 3 years ago • 14 comments

I am using Netcode for GameObjects, but everytime I try to build it to WebGL, it gives a "RuntimeError: null function or function signature mismatch,RuntimeError: null function or function signature mismatch" error.

I started using the web socket transport, and I was wondering how I would be able to set up clients for WebGL. I want a linux server and have WebGL clients connect to it. For testing purposes, I want to host using a Windows machine and use WebGL to connect clients to it. However, the error persists.

Is there more setup I need to do before I can build for WebGL? Why does the error persistent even though I am using a web socket transport for my WebGL build?

Screenshot Screenshot2

Ripper53 avatar Jan 03 '22 00:01 Ripper53

I'm wondering if there's any package that is incompatible with WebGL builds, unrelated to the Netcode package, that I have in my Unity project:

  "dependencies": {
    "com.unity.collab-proxy": "1.15.4",
    "com.unity.feature.2d": "1.0.0",
    "com.unity.ide.rider": "3.0.7",
    "com.unity.ide.visualstudio": "2.0.12",
    "com.unity.ide.vscode": "1.2.4",
    "com.unity.inputsystem": "1.2.0",
    "com.unity.netcode.gameobjects": "1.0.0-pre.3",
    "com.unity.render-pipelines.universal": "12.1.2",
    "com.unity.test-framework": "1.1.29",
    "com.unity.textmeshpro": "3.0.6",
    "com.unity.timeline": "1.6.3",
    "com.unity.ugui": "1.0.0",
    "com.unity.visualscripting": "1.7.6",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  }
}

Ripper53 avatar Jan 06 '22 09:01 Ripper53

I have the same error. Please help!

Esquilofrenik0 avatar Jan 21 '22 11:01 Esquilofrenik0

Here's the error I get for more context: image image image I believe a dll file may be missing, because none of the dll imports seem to work.

Ripper53 avatar Jan 21 '22 23:01 Ripper53

I've been looking through the JSWebSocketClient.jslib file and nothing seems to be wrong with it. I thought maybe it was because it was not under a Plugins folder, but I put it under one and that does not fix the issue. I changed Pointer_stringify to UTF8ToString, because the former is obsolete but still the issue persists.

Any help on this would be greatly appreciated! I need to get this working as soon as possible.

Ripper53 avatar Jan 23 '22 00:01 Ripper53

Update: this seems to be a problem with netcode, not the websocket transport layer. I created another project, built it, it worked fine. Then, I added netcode for gameobjects, built it, worked fine. Then, I added the NetworkManager component to a game object, built it, it failed. Then I removed the NetworkManager, built it, and it failed again. Seems to keep failing now. I'm assuming this is a problem with the netcode for gameobjects and not the websocket transport layer.

Ripper53 avatar Jan 23 '22 04:01 Ripper53

Same problem here. Will WebGL suported with Netcode for GameObjects? It'd be a lot cooler it did.

uacaman avatar Jan 29 '22 18:01 uacaman

Can you explain that isn't WebSocket transport supported for WebGL export?

When I choose WebSocket transport for my NetworkManager, my web export is stucking at 90%.

Please Unity, fix this.

rohanrhu avatar Feb 06 '22 20:02 rohanrhu

Has anyone been able to solve the problem ?

theomonnom avatar Mar 10 '22 00:03 theomonnom

Same problem, I've tried everything I could think of. Does anyone know any workarounds or alternatives? I just wanted my client to work on browser too

GloamingCat avatar Apr 12 '22 23:04 GloamingCat

It's this package that makes this happen: "com.unity.netcode.gameobjects": "1.0.0-pre.7" I went step by step, adding each package and exporting to webGL. This is the only package that causes this bug. When will there be a fix?

BunZaga-CA avatar May 08 '22 04:05 BunZaga-CA

Getting the same error, my project does not contain netcode

ElwoodHogan avatar Jun 09 '22 22:06 ElwoodHogan

Has anyone gotten this to work on webgl? I am getting the same EntryPointNotFoundException.

@Ripper53 did you ever get past this?

brian-kryptomon avatar Jul 19 '22 18:07 brian-kryptomon

When I run it as a WebGL build it tries to connect and I see it connect on the server but then I get this error:

Invoking error handler due to ReferenceError: Runtime is not defined unityFramework/__Connect/state.ws.onclose@http://localhost:52557/Build/builds.framework.js.gz:3:72053 EventHandlerNonNull*__Connect@http://localhost:52557/Build/builds.framework.js.gz:3:71946 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[100802]:0x16748c3 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[594]:0x949c2 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[100744]:0x1671020 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[45282]:0xb08959 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[66522]:0x107146e @http://localhost:52557/Build/builds.wasm.gz:wasm-function[53713]:0xe67775 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[11114]:0x2f5a38 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[106076]:0x1779d19 invoke_iiii@http://localhost:52557/Build/builds.framework.js.gz:3:398473

brian-kryptomon avatar Jul 19 '22 18:07 brian-kryptomon

When I run it as a WebGL build it tries to connect and I see it connect on the server but then I get this error:

Invoking error handler due to ReferenceError: Runtime is not defined unityFramework/__Connect/state.ws.onclose@http://localhost:52557/Build/builds.framework.js.gz:3:72053 EventHandlerNonNull*__Connect@http://localhost:52557/Build/builds.framework.js.gz:3:71946 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[100802]:0x16748c3 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[594]:0x949c2 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[100744]:0x1671020 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[45282]:0xb08959 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[66522]:0x107146e @http://localhost:52557/Build/builds.wasm.gz:wasm-function[53713]:0xe67775 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[11114]:0x2f5a38 @http://localhost:52557/Build/builds.wasm.gz:wasm-function[106076]:0x1779d19 invoke_iiii@http://localhost:52557/Build/builds.framework.js.gz:3:398473

I hobbled together a somewhat hotfix version to get client reconnect working and have it work in the editor to support reconnect as well based on an existing PR https://github.com/Unity-Technologies/multiplayer-community-contributions/pull/174 (also wrote a comment there).

https://github.com/nicholas-maltbie/multiplayer-community-contributions/tree/webgl-patch

I have a working example I've tested locally and via the browser here https://github.com/nicholas-maltbie/NetworkStateMachineUnity

Imported via this path - git+https://github.com/nicholas-maltbie/multiplayer-community-contributions?path=/Transports/com.community.netcode.transport.websocket#webgl-patch Hopefully it works as a hotfix until they can merge this change into the official version :)

I've verified that it works with version 1.1.0 of the netcode project as well.

nicholas-maltbie avatar Nov 22 '22 09:11 nicholas-maltbie