unityContext.on(8.8) → ?? (9.0.3) #404
Answered by jeffreylanters
devilofdev asked this question in Help Wanted!
-
| i used below code (react-unity-webgl@8.8.0) useEffect(() => { unityContext.on("unityToFront", PassOnSessionInfo); return function () { unityContext.removeAllEventListeners(); unityContext.quitUnityInstance(); }; }, []);in 9.0.3 version, i thought that unityContext.on === addEventListener.. but not working useEffect(() => { addEventListener("unityToFront", PassOnSessionInfo); return function () { removeEventListener("unityToFront", PassOnSessionInfo); }; }, []); |
Beta Was this translation helpful? Give feedback.
Answered by jeffreylanters Jun 29, 2022
Replies: 2 comments 3 replies
-
| Hi, don't forget to add both the add and remove event listener as well as you own callback to the dependency array. Let me know if this worked. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by jeffreylanters
-
| You have to change the Unity Javascript PLUGIN part aswell. https://react-unity-webgl.dev/docs/api/event-system |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Hi, don't forget to add both the add and remove event listener as well as you own callback to the dependency array. Let me know if this worked.