OpenUrl在编辑和运行时工作,但在构建Android后不起作用

发布于 2025-02-06 08:11:27 字数 499 浏览 0 评论 0原文

因此,我正在尝试制作一个按钮,该按钮在单击时打开网页。这是该功能的代码:

public void ToHyperLink()
    {
        string theURL = parentButton.GetComponent<BLButton>().btnRefObj.GetComponent<HyperlinkAttri>().prodURL;
        Application.OpenURL(theURL);
    }

URL像这样通过检查员:

在我的PC上测试它时,这可以很好地工作,但是一旦它构建到我的Android手机,它就会停止工作。

So I am trying to make a button that opens up to a webpage when clicked. Here is the code for the function:

public void ToHyperLink()
    {
        string theURL = parentButton.GetComponent<BLButton>().btnRefObj.GetComponent<HyperlinkAttri>().prodURL;
        Application.OpenURL(theURL);
    }

The URL is passed through the inspector like this:
enter image description here

This works perfectly fine when testing it on my PC, but once it is built to my Android phone it stops working.

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

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

发布评论

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

评论(1

倒带 2025-02-13 08:11:27

刚刚测试了它。 application.openurl(“ http://google.com”);直接工作。直接进行链接并检查是否到了。然后单击构建和运行,然后检查是否有任何错误。

Just tested it. Application.OpenURL("http://google.com"); works fine.Give the link directly and check if it is coming.You can install Android Logcat from package manager and connect android phone via usb and click build and run and check for any errors.

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