Issue with Metamask connect #419
-
Hopefully someone can help me here, as I've really hit a wall: added unity to react via react-unity-webgl it works, but upon hitting connect to connect with metamask I get this weird error. game works perfectly fine in standalone... anyone got any idea? Component
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
When using a WebGL plugin in your Unity project, it may contain custom JavaScript. This is usually inserted into the output HTML. When using React Unity WebGL, your only using the actual Unity build, and are not including the build's HTML thus losing the JavaScript included with it. This is why you're getting this error. A solution would be to move the build's external JavaScript into your project, and include it into your React's base HTML. |
Beta Was this translation helpful? Give feedback.
-
I also have same issue. |
Beta Was this translation helpful? Give feedback.
-
Hi @DarlingUUi! My guess is that it has to do with the fact that your send message is invoked during an asynchronous callback in the "then" closure. This means that it's possible for the component to have been rerendered in the meanwhile, without the reference to the SendMessage callback to be updated since it's out of scope. This would be a problem in any React project. A solution would be to move the actual trigger of the method to an Effect hook. |
Beta Was this translation helpful? Give feedback.
When using a WebGL plugin in your Unity project, it may contain custom JavaScript. This is usually inserted into the output HTML.
When using React Unity WebGL, your only using the actual Unity build, and are not including the build's HTML thus losing the JavaScript included with it. This is why you're getting this error.
A solution would be to move the build's external JavaScript into your project, and include it into your React's base HTML.