Skip to content

Conversation

@Niaobu
Copy link

@Niaobu Niaobu commented Dec 19, 2025

Problem

Unity 6 (6000.x) WebGL builds crash with RuntimeError: function signature mismatch when receiving WebSocket messages. This happens because Unity 6 uses a newer Emscripten version where Module.dynCall_* functions are deprecated.

Solution

Replace all Module.dynCall_* invocations with the new makeDynCall syntax as per Unity's official deprecation guidance:

// Before (deprecated):
Module.dynCall_vi(webSocketState.onOpen, instanceId);

// After (Unity 6 compatible):
{{{ makeDynCall('vi', 'webSocketState.onOpen') }}}(instanceId);

Changes

  • onOpen callback: dynCall_vimakeDynCall('vi', ...)
  • onMessage callback (2x): dynCall_viiimakeDynCall('viii', ...)
  • onError callback: dynCall_viimakeDynCall('vii', ...)
  • onClose callback: dynCall_viimakeDynCall('vii', ...)

Testing

Tested on Unity 6000.0.63f1 WebGL build - WebSocket connections now work correctly without crashes.

Related

This is similar to PR #54 which fixed the earlier Runtime.dynCallModule.dynCall_* migration for Unity 2021.2.

…makeDynCall

Unity 6 uses a newer Emscripten version where Module.dynCall_* functions are
deprecated and cause "RuntimeError: function signature mismatch" crashes on
WebGL builds.

This replaces all dynCall invocations with the new makeDynCall syntax as per
Unity's official guidance:
https://docs.unity3d.com/6000.0/Documentation/Manual/web-interacting-browser-deprecated.html

Changes:
- onOpen callback: dynCall_vi -> makeDynCall('vi', ...)
- onMessage callback (2x): dynCall_viii -> makeDynCall('viii', ...)
- onError callback: dynCall_vii -> makeDynCall('vii', ...)
- onClose callback: dynCall_vii -> makeDynCall('vii', ...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant