#V2021.2.X Variable Runtime replaced by Module[dynCall]
1 messages ยท Page 1 of 1 (latest)
Couple notes as I don't know about this issue, but would like to know more.
- If you are able, would you be willing to provide some links to any of the multiple issues about this error?
- It might be helpful if you have the ability to provide some instructions for recreating the errors. (I personally might not be able to help, but would be willing to at least help put together some notes on any findings)
- If you would be willing to provide some details about which plugins and possibly the version(s) that are broken.
Sure thing. Give me a second to collect more detailed data.
No worries, take your time. I tried searching a bit and was having difficulty so I appreciate it.
Unity version:
2021.2.7f
Best example would be with Mirror network plugin. I will add Issue link here.
https://github.com/vis2k/Mirror/issues/3012
The same error is with this plugin as well,
https://github.com/kou-yeung/WebGLInput
there is multiple issues with this:
https://github.com/kou-yeung/WebGLInput/issues/63
This might have been connected as well:
https://issuetracker.unity3d.com/issues/webgl-wasm-uncaught-runtimeerror-exception-is-thrown-when-calling-a-native-function-from-a-static-linked-library?_ga=2.15941621.2113302106.1641255402-1528161758.1604458013
This is where I found idea about Runtime beeing removed:
https://stackoverflow.com/questions/70411564/unity-webgl-throws-error-referenceerror-runtime-is-not-defined/70493943
Another workaround is opening build.framework.js after build, and renaming all Runtime.dynCall(<..>) to just dynCall. This works somehow, but not everything goes well after it.
I can't find more, but I seen that there were same problems with WebSockets in unity usage. Well it is mosty webGL problem.
The SimpleWeb.jslib plugin utilizes obsolete API such as Runtime and Pointer_stringify Steps to reproduce -> Make any WebGL build -> deploy webgl and server parts -> launch web...
IME for Unity WebGL. Contribute to kou-yeung/WebGLInput development by creating an account on GitHub.
Unity 2021.2.0b4.3123, in line 4 & 9 of WebGLWindow.jslib : Runtime.dynCall("v", cb, []); will throw 'Uncaught ReferenceError: Runtime is not defined'.
Reproduction steps: 1. Open the project from the GitHub repository provided by the user 2. Switch Platform to WebGL in Build Setting...
Reproduction is just Creating new UDP build and adding Mirror addon to it (any websockets plugin will work as well). Anything that have jslib file with dynCall. And run webgl build
Trying to reproduce this took a bit, and not sure I have recreated it correctly.
When you are available let me know if you have any feedback on the following steps:
- Unity HUB -> New Project -> Change editor to 2021.2.7f1 -> Select 3D (URP) -> Create Project
- Add mirror package from package manager
- Go to build settings and select webgl, then change build, then build
- Run webserver or if unity's works visit browser
- Scene rendered, didn't see any errors other than firefox bug workaround (see screenshot)
Maybe I need to use something from mirror to see the error, but not sure what that would be.
Let me know if you have some suggestions.
Sorry for late reply. I was not able to connect to this discord account from other machine.
To be more precise, you need to add network manager to the scene. Also to replace transport layer to websockets (as webgl only works with that). To make it easier you can use example scene in Mirror folder. Mirror/Examples/Basic. On network manager remove KPC transport script, then add SimpleWebTransport script. (Network manager will catch it automatically, but to be 100 % secure you can drag transport layer to network manager). I will add screen shot below.
On unity editor start scene, chose server only button (as webgl cannot be server). Build and Run selected scene, on browser chose client button. It will return the error code.
Just double checked with new project, error is returned as expected.
Thank you for you time!
Okay I followed those instructions, but I am unable to see the buttons in the canvas.
When I play the scene in unity I have the buttons from the canvas (host server, etc), but when it runs in webgl there are no buttons, and no console errors. (Other than firefox bug workaround previously mentioned)
I tested microsoft edge as well, and had no buttons, and no errors as well.
Do you want to try sending me your project folder in a zip or something?
- Not sure that this would be different, but maybe include your build folder as well?
I may have built the wrong scene. I am trying again now. Unity takes about 10 minutes on my machine for each build.
are you building correct scene? as in build options you added current scene to build list? It is very weird that there is no UI. I am building zip now
oh lol ๐ we thought about same thing at the same time ๐
Yeah, it might be that I did the wrong scene.
Yea webGL build are painfully long
haha yes
tell me about it, what frustration
I have learned curse words long forgotten just for unity
Google Drive is a free way to keep your files backed up and easy to reach from any phone, tablet, or computer. Start with 15GB of Google storage โ free.
this is the package just in case
Thanks for doing that, I will let you know my results after this build completes
Thank you
Yup, that is totally that lovely error ๐ฆ (still cant make my self smile about it)
Is one of the biggest problems with this error the inability to use mirror (networking)?
Well, with my workaround I was able to use mirror. But mirror is not only plugin than uses Runtime.dynCall. Pretty much any plugin than uses interaction between jslib and unity will have this, as long they use that function. And that mentioned workaround works only on non compressed versions of the build.
I used mirror as example as it is one of more popular assets. But other assets have same errors.
Got it, makes sense.
Does your workaround require that you modify the generated webgl build folder code? (or is this changes to the libraries / plugins internals?)
- You may have already answered this so don't feel that you have to repeat yourself. It's just been a long day so far.
My workaround was renaming it in build.framework.js. By just removing Runtime. part. I tried to go into plugins and do that there, but I was not to sure how to change each of name there. for example
Runtime.dynCall('vi', webSocketState.onOpen, [ instanceId ]);
for
Module['dynCall_vi'](webSocketState.onOpen, instanceId);
or it should be
Module['dynCall_vi'](webSocketState.onOpen, [instanceId]);
And it gets more complicated as it gets into multiple variables passed in. When I tried to change it this way I still get some errors, less, but still some. My guess is that I missed it somewhere.
So, I just finished a new webgl build with a drop in mirror replacement, and I didn't get any errors and was able to get client server connection going (I think, still looking at all the info). If you want I can provide steps for recreation, but I know this doesn't help other non-mirror plugin compatibility issues.
Would you happen to know the names of some of the other plugins that break, if they are free plugins or not, and if the reason they break has anything to do with a dependency on mirror?