Webgl FTP 错误

Webgl FTP error

我在使用 ftp 连接存储和加载 .xml 文件的统一 webgl 构建时遇到问题。在编辑器和本地 ftp 服务器(使用 Xlight)上一切正常。但是当我构建一个 webgl 解决方案并尝试保存一个 .xml 文件时,我收到以下错误:

> Uncaught abort() at Error
    at jsStackTrace (http://localhost:8080/Development/WebGL.js:875:12)
    at stackTrace (http://localhost:8080/Development/WebGL.js:889:21)
    at abort (http://localhost:8080/Development/WebGL.js:3830852:24)
    at _pthread_create (http://localhost:8080/Development/WebGL.js:13183:2)
    at __ZN6il2cpp2os10ThreadImpl3RunEPFvPvES2_ [il2cpp::os::ThreadImpl::Run(undefined?F?*, void, void*)] (http://localhost:8080/Development/WebGL.js:3596270:50)
    at Array.__ZN6il2cpp2os6Thread3RunEPFvPvES2_ [il2cpp::os::Thread::Run(undefined?F?*, void, void*)] (http://localhost:8080/Development/WebGL.js:3746555:7)
    at Object.dynCall_iiii (http://localhost:8080/Development/WebGL.js:3807075:39)
    at invoke_iiii (http://localhost:8080/Development/WebGL.js:16008:32)
    at Array.__ZN6il2cpp6icalls8mscorlib6System9Threading6Thread15Thread_internalEP12Il2CppThreadP14Il2CppDelegate [il2cpp::icalls::mscorlib::System::Threading::Thread::Thread_internal(Il2CppDelegate?**)] (http://localhost:8080/Development/WebGL.js:2708698:6)
    at Object.dynCall_iii (http://localhost:8080/Development/WebGL.js:3813716:38)

我完全不知道这意味着什么或如何远程解决这个问题。我对服务器技术的兴趣并不是一直都很高,所以在这件事上提供一些帮助将不胜感激。

这是我目前使用的 xml 上传代码:

 FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://localhost/construct.xml");
    request.Method = WebRequestMethods.Ftp.UploadFile;
    request.Credentials = new NetworkCredential("name", "password");

    string xml = xmlDoc.OuterXml;
    byte[] bytes = Encoding.UTF8.GetBytes(xml);

    Stream requestStream = request.GetRequestStream();
    requestStream.Write(bytes, 0, bytes.Length);
    requestStream.Close();

    FtpWebResponse response = (FtpWebResponse)request.GetResponse();
    response.Close();

如果还有什么我遗漏的,请告诉我。提前致谢!

无法将 WebRequest 与 Unity HTML5 导出的项目一起使用,因为 WebRequest 依赖于线程。 Unity 的导出到 HTML5 选项不支持线程(目前)。堆栈跟踪的关键部分是:

at _pthread_create (http://localhost:8080/Development/WebGL.js:13183:2)

None 的pthread API 方法由emscripten 实现。在未来的某个时候,我们可能会在 JavaScript 中提供来自各种浏览器的线程支持,但现在不可用。

请注意,这在编辑器中确实有效,即使选择了 WebGL 平台也是如此,因为 Unity 不会像对 Web 播放器那样限制 WebGL 平台的 .NET 配置文件。我们正在考虑使用配置文件为 WebGL 等平台提供更早的错误信息,但我们还没有实现它。