为什么在 Linux 上执行 GET 请求时 UnityWebRequest 会返回未知错误? [英] Why does UnityWebRequest return unkown error when I do a GET request on Linux?

查看:37
本文介绍了为什么在 Linux 上执行 GET 请求时 UnityWebRequest 会返回未知错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

public class DatabaseHandler : MonoBehaviour
{

    string url = "https://fakeid.firebaseio.com/";
    void Start()
    {
        StartCoroutine(GetLevelsCoroutine());
    }

    IEnumerator GetLevelsCoroutine()
    {    
        using (UnityWebRequest www = UnityWebRequest.Get(url))
        {
            www.SetRequestHeader("X-Firebase-Decoding", "1");
            yield return www.SendWebRequest();
            if (www.isDone)
            {
                Debug.Log(www.error);
                string result = www.downloadHandler.text;
                Debug.Log(result);
            }
        }
    }


}

结果变量为空,www.error为未知错误"我一直在尝试不同的方法来解决这个问题,但是,我无法弄清楚是什么导致了这个错误,因为这只是一个一般性错误.

The result variable is null and the www.error is "unknown error" I have been trying different things in order to fix this but, I just can't figure out what's causing this error, since it's just a generic error.

我也读到这可能是 unitywebrequest 的错误,如果是这样,有没有其他选择?

I have also read that this may be an unitywebrequest bug, if it is so, are there any alternatives?

推荐答案

终于找到了问题的解决方案.(它只发生在一些 Linux 操作系统上)

Finally found the solution to the problem. (It only occurs on some Linux OS)

Unity 仅正式支持 Ubuntu Linux,因此它正在寻找(但未能找到)它所期望的证书存储.您可以通过创建符号链接在 Fedora 上解决:

Unity only officially supports Ubuntu Linux, so it is looking (and failing to find) the certificate store where it would expect it to be. You can work around on Fedora by creating a symbolic link:

mkdir -p /etc/ssl/certs && ln -s /etc/pki/tls/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt

这是我的来源:https://forum.unity.com/threads/ubuntu-headless-build-tls-handshake-fails.546704/

这篇关于为什么在 Linux 上执行 GET 请求时 UnityWebRequest 会返回未知错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆