Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

WebGL Build Won't Load

Discussion in 'Netcode for GameObjects' started by spectre1989, Feb 11, 2022.

  1. spectre1989

    spectre1989

    Joined:
    Oct 6, 2009
    Posts:
    125
    Hi all,

    I read that Netcode for GameObjects can work with a community WebGL transport, but if I just so much as create an empty project and install
    com.unity.netcode.gameobjects
    and
    [URL='https://github.com/Unity-Technologies/multiplayer-community-contributions.git?path=/Transports/com.community.netcode.transport.enet']https://github.com/Unity-Technologies/multiplayer-community-contributions.git?path=/Transports/com.community.netcode.transport.[/URL]websocket
    and create a WebGL build, when I load the page I get the following errors in the console:
    Code (csharp):
    1. webgltestweb.loader.js:70 exception thrown: RuntimeError: null function or function signature mismatch,RuntimeError: null function or function signature mismatch
    2.     at il2cpp::vm::MetadataCache::ExecuteModuleInitializers() (http://localhost:8080/Build/webgltestweb.wasm:wasm-function[1538]:0x95ac9)
    3.     at dynCall_v (http://localhost:8080/Build/webgltestweb.wasm:wasm-function[63100]:0x151f793)
    4.     at http://localhost:8080/Build/webgltestweb.framework.js:1035:20
    5.     at invoke_v (http://localhost:8080/Build/webgltestweb.framework.js:14214:3)
    6.     at main (http://localhost:8080/Build/webgltestweb.wasm:wasm-function[59363]:0x135822d)
    7.     at http://localhost:8080/Build/webgltestweb.framework.js:1035:20
    8.     at callMain (http://localhost:8080/Build/webgltestweb.framework.js:17645:13)
    9.     at doRun (http://localhost:8080/Build/webgltestweb.framework.js:17688:21)
    10.     at run (http://localhost:8080/Build/webgltestweb.framework.js:17700:3)
    11.     at runCaller (http://localhost:8080/Build/webgltestweb.framework.js:17628:18)
    12.     at Object.removeRunDependency (http://localhost:8080/Build/webgltestweb.framework.js:990:4)
    13.     at http://localhost:8080/Build/webgltestweb.framework.js:60:12
    14.     at doCallback (http://localhost:8080/Build/webgltestweb.framework.js:4558:11)
    15.     at done (http://localhost:8080/Build/webgltestweb.framework.js:4569:5)
    16.     at IDBTransaction.transaction.oncomplete (http://localhost:8080/Build/webgltestweb.framework.js:3925:5)
    17. printErr @ webgltestweb.loader.js:70
    18. webgltestweb.framework.js:181 Uncaught RuntimeError: null function or function signature mismatch
    19.     at il2cpp::vm::MetadataCache::ExecuteModuleInitializers() (:8080/Build/webgltestweb.wasm)
    20.     at dynCall_v (:8080/Build/webgltestweb.wasm)
    21.     at :8080/Build/webgltestweb.framework.js:1035:20
    22.     at invoke_v (:8080/Build/webgltestweb.framework.js:14214:3)
    23.     at main (:8080/Build/webgltestweb.wasm)
    24.     at :8080/Build/webgltestweb.framework.js:1035:20
    25.     at callMain (:8080/Build/webgltestweb.framework.js:17645:13)
    26.     at doRun (:8080/Build/webgltestweb.framework.js:17688:21)
    27.     at run (:8080/Build/webgltestweb.framework.js:17700:3)
    28.     at runCaller (:8080/Build/webgltestweb.framework.js:17628:18)
    29.     at Object.removeRunDependency (:8080/Build/webgltestweb.framework.js:990:4)
    30.     at :8080/Build/webgltestweb.framework.js:60:12
    31.     at doCallback (:8080/Build/webgltestweb.framework.js:4558:11)
    32.     at done (:8080/Build/webgltestweb.framework.js:4569:5)
    33.     at IDBTransaction.transaction.oncomplete (:8080/Build/webgltestweb.framework.js:3925:5)
    34. $il2cpp::vm::MetadataCache::ExecuteModuleInitializers() @ webgltestweb.wasm:0x95ac9
    35. $dynCall_v @ webgltestweb.wasm:0x151f793
    36. (anonymous) @ webgltestweb.framework.js:1035
    37. invoke_v @ webgltestweb.framework.js:14214
    38. $main @ webgltestweb.wasm:0x135822d
    39. (anonymous) @ webgltestweb.framework.js:1035
    40. callMain @ webgltestweb.framework.js:17645
    41. doRun @ webgltestweb.framework.js:17688
    42. run @ webgltestweb.framework.js:17700
    43. runCaller @ webgltestweb.framework.js:17628
    44. removeRunDependency @ webgltestweb.framework.js:990
    45. (anonymous) @ webgltestweb.framework.js:60
    46. doCallback @ webgltestweb.framework.js:4558
    47. done @ webgltestweb.framework.js:4569
    48. transaction.oncomplete @ webgltestweb.framework.js:3925
    49. webgltestweb.wasm:0x1464e31 Uncaught RuntimeError: memory access out of bounds
    50.     at OrientationChangeHandler(int, int, int) (webgltestweb.wasm:0x1464e31)
    51.     at dynCall_viii (webgltestweb.wasm:0x151f7e1)
    52.     at webgltestweb.framework.js:1035:20
    53.     at JS_ScreenOrientation_eventHandler (webgltestweb.framework.js:1882:37)
    54. $OrientationChangeHandler(int, int, int) @ webgltestweb.wasm:0x1464e31
    55. $dynCall_viii @ webgltestweb.wasm:0x151f7e1
    56. (anonymous) @ webgltestweb.framework.js:1035
    57. JS_ScreenOrientation_eventHandler @ webgltestweb.framework.js:1882
    58. setTimeout (async)
    59. _JS_ScreenOrientation_Init @ webgltestweb.framework.js:1900
    60. $main @ webgltestweb.wasm:0x1350129
    61. (anonymous) @ webgltestweb.framework.js:1035
    62. callMain @ webgltestweb.framework.js:17645
    63. doRun @ webgltestweb.framework.js:17688
    64. run @ webgltestweb.framework.js:17700
    65. runCaller @ webgltestweb.framework.js:17628
    66. removeRunDependency @ webgltestweb.framework.js:990
    67. (anonymous) @ webgltestweb.framework.js:60
    68. doCallback @ webgltestweb.framework.js:4558
    69. done @ webgltestweb.framework.js:4569
    70. transaction.oncomplete @ webgltestweb.framework.js:3925
    71. webgltestweb.wasm:0x1464e31 Uncaught RuntimeError: memory access out of bounds
    72.     at OrientationChangeHandler(int, int, int) (webgltestweb.wasm:0x1464e31)
    73.     at dynCall_viii (webgltestweb.wasm:0x151f7e1)
    74.     at webgltestweb.framework.js:1035:20
    75.     at JS_ScreenOrientation_eventHandler (webgltestweb.framework.js:1882:37)
    I've tried this with both 2021 and 2020 and can't get it to work, any ideas?
     
    KingKRoecks likes this.
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,888
    KingKRoecks and spectre1989 like this.
  3. spectre1989

    spectre1989

    Joined:
    Oct 6, 2009
    Posts:
    125
  4. KingKRoecks

    KingKRoecks

    Joined:
    Jul 28, 2013
    Posts:
    152
    Is there any known workaround or ETA?
    I'm encountering this as well and am curious about the timeline for the fix.

    Happening still as of 2021.2.14f1
     
  5. EvgenyTorkin

    EvgenyTorkin

    Joined:
    May 6, 2022
    Posts:
    6
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,888
    Yes, you can reflect the assemblies used in the project and look for module initializers. I'd recommend a tool like ILSpy for this. Those module initializers trigger this issue.

    You can find out more about module initializers here: https://docs.microsoft.com/en-us/do...ence/proposals/csharp-9.0/module-initializers

    It looks like this fix should have already been back ported, but it got stuck in the release process somewhere. I'm trying to track that down now, so hopefully it will move forward soon.
     
  7. EvgenyTorkin

    EvgenyTorkin

    Joined:
    May 6, 2022
    Posts:
    6
    Big thanks! Can you tell me when there will be information about the version of the editor in which this fix will be, please?
     
  8. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,888
  9. Brian-Kryptomon

    Brian-Kryptomon

    Joined:
    Apr 17, 2022
    Posts:
    17
    @JoshPeterson Do you know if theres any update on this? I see it was fixed in the 2022.2.x release but the backports are pending.

    We are running 2021.3.X and are running into this issue when trying to add netcode to our existing game so I am hoping you have a fix soon.
     
  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,888
    I don't have an ETA on a release for 2021.3, sorry. I do know that the fix in in a release branch, so I expect it will happen within the next few weeks.
     
  11. Brian-Kryptomon

    Brian-Kryptomon

    Joined:
    Apr 17, 2022
    Posts:
    17
    Thanks greatly appreciate the response - so whats weird is this doesn't happen on all projects for me. I have a webgl version running netcode and it works fine but then I tried to add this to another project and it breaks.

    Do we have a root cause on it? Maybe theres something I could change in my project to make it work in the meantime.
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,888
    Yes, the original problem was a bug in the way IL2CPP handled module initializers (see the link above in this thread for details about them). The netcode code uses them, so I'm surprised that this works sometimes, because I think that it should always fail if the module initializers are used.