Unity WebGL MetAmask连接-NethereumunityInstance未定义JavaScript

发布于 2025-01-25 02:35:40 字数 1183 浏览 4 评论 0原文

我试图将MetAmask钱包连接到Unity WebGL。 这是我提到的GitHub示例项目链接。

https://github.com/nethereum/nethereum/nethereum/nethereum/nethereum.unity.unity.unity.webgl

我安装了安装的安装同一版本的Unity使示例项目正常工作。

  • Unity版本:2021.2.13F1
  • Microsoft Visual Studio:2022

我构建并运行该项目。

这是构建设置窗口

运行后,没有任何问题。

我单击[连接]按钮

和metAmask Extension窗口像其他MetAmask钱包一样弹出,

连接到MetAmask后,我不断遇到此错误。

这是错误的图像

这是浏览器javascript控制台错误

这是构建文件夹中最初发生错误的地方

我不知道为什么会发生这种情况。 我手动跟随示例项目。

我必须将metamask连接到Unity WebGL。 我必须通过连接到Unity WebGL的帐户运行交易。

有人可以帮我吗? 有人可以给我连接和运行交易的其他选择吗?

I tried to connect Metamask wallet to Unity WebGL.
Here is the github sample project link that I refered.

https://github.com/Nethereum/Nethereum.Unity.Webgl

I installed the same version of Unity to let the sample project work properly.

  • Unity Version : 2021.2.13f1
  • Microsoft Visual Studio : 2022

I built and run the project.

This is the build settings window

After running, there was not any problem.

I click the [Connect] button

And the Metamask extension window popped up as like other Metamask wallet connections

After connect to the Metamask I continuously got this error.

This is the image of the error

This is the image of browser javascript console error

This is the place in build folder where the error is originally occured

I do not know why this happeneds.
I manually followed the sample project.

I have to connect Metamask to Unity WebGL.
And I have to run a transaction via an account that is connected to Unity WebGL.

Could anybody help me?
Could anybody give me alternative option to connect and run a transaction ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

z祗昰~ 2025-02-01 02:35:40

您必须编辑索引

createUnityInstance(canvas, config, (progress) => {
    progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => {
  nethereumUnityInstance = unityInstance;
  loadingBar.style.display = "none";
  fullscreenButton.onclick = () => {
    unityInstance.SetFullscreen(1);
  };
})

。 /eskoes/5“ rel =” nofollow noreferrer“> github nethereum#5

You have to edit the index.html to add nethereumUnityInstance = unityInstance;

createUnityInstance(canvas, config, (progress) => {
    progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => {
  nethereumUnityInstance = unityInstance;
  loadingBar.style.display = "none";
  fullscreenButton.onclick = () => {
    unityInstance.SetFullscreen(1);
  };
})

There is a github issue about it here: GitHub Nethereum #5

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文