dispatchReactUnityEvent is not a function #440
Replies: 4 comments 8 replies
-
Hi! Have you registered an event listener. Could you share some more code on your React side of things? |
Beta Was this translation helpful? Give feedback.
-
Hello, Currently event listener is registered in the react component: const {
addEventListener,
removeEventListener,
isLoaded,
sendMessage,
unityProvider,
loadingProgression,
} = useUnityContext({
loaderUrl: `${TDS_3D_UNITY_URL}/tds-3d-unity-core.loader.js`,
dataUrl: `${TDS_3D_UNITY_URL}/tds-3d-unity-core.data`,
frameworkUrl: `${TDS_3D_UNITY_URL}/tds-3d-unity-core.framework.js`,
codeUrl: `${TDS_3D_UNITY_URL}/tds-3d-unity-core.wasm`,
}); and
|
Beta Was this translation helpful? Give feedback.
-
Thank you for your response and your patience. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone, It's been quite a while and I wanted to give an update. Due to some unforeseen side projects, I have been delayed in working on this. This week I tried again, and it worked without any problems. This means for me that this topic can be closed. Kind regards |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Please avoid duplicates
Language and Compiler
TypeScript's built-in Compiler
What environment are you using?
Other
When does your problem occur?
When the Unity App is running
What does your problem relate to?
I don't know
React-Unity-WebGL Version
9.0.4
React Version
17.0.2
Unity Version
2020.3.37f1
What happened?
Hello,
Followed the instructions in the documentation. In Unity I created under Plugins/WebGL a file "React.jslib" with following content:
Inside of Unity
The Initialize method is called by the React-Frontend and works.
Now I want to give a message back after the initialization happened. Therefore, I added the UnityContextInitialized("Initialized") call.
While the project is run and opened, the following message shows up in the console output:
TypeError: window.dispatchReactUnityEvent is not a function.
I see the log message from this console.log: console.log("Unity: " + UTF8ToString(message));
Any ideas?
Reproducible test case
No response
Would you be interested in contributing a fix?
Beta Was this translation helpful? Give feedback.
All reactions