Mix pure js and react js #277
-
Hey thanks for this amazing pacakge! I have one question about using the unity instance inside react js and pure js files. I added your package to an existing unity project. I already have many scripts which are using the normal unityinstance which was defined and created inside the index template before. I added your package and my react js app to my unity project. It is working, but I also still want to use my old javascript files, which needs the unityinstance. So how can I use the unityinstance inside pure js and react js at the same time? I did not try to use the createUnityInstance() function, because you are doing it already in your package right? I would have conflicts when loading unity 2 times. I hope there is a way to solve it. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Well, I created a global variable for the unityinstance inside a script and set it in react with the UnityContext.
I tried to use the Maybe I am missing something, but for now it is working |
Beta Was this translation helpful? Give feedback.
Well, I created a global variable for the unityinstance inside a script and set it in react with the UnityContext.
I tried to use the
loaded
andcanvas
event, but whenloaded
is fired,unityInstance
was still null and thecanvas
event I did not even recevied that.Maybe I am missing something, but for now it is working