我已经为 WebGL 平台构建了游戏,并尝试在 MAMP 本地主机上运行它。我在 Google Chrome(版本 44.0.2403.125(64 位))和 Safari(版本 8.0.3 (10600.3.18))中收到以下警报消息。
错误消息
An error occurred running the Unity content on this page. See your browser's JavaScript console for more info. The error was:
Uncaught abort() at Error
at jsStackTrace (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:1000:13)
at stackTrace (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:1017:22)
at abort (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:5234547:25)
at _pthread_create (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:10991:59)
at __ZN6il2cpp2os10ThreadImpl3RunEPFvPvES2_ [il2cpp::os::ThreadImpl::Run(undefined?F?*, void, void*)] (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:80702:9)
at __ZN6il2cpp2os6Thread3RunEPFvPvES2_ [il2cpp::os::Thread::Run(undefined?F?*, void, void*)] (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:73176:8)
at Array.__ZN6il2cpp6icalls8mscorlib6System9Threading6Thread15Thread_internalEP12Il2CppThreadP14Il2CppDelegate [il2cpp::icalls::mscorlib::System::Threading::Thread::Thread_internal(Il2CppDelegate?**)] (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:60773:3)
at _Thread_Thread_internal_m22186 (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:4700724:38)
at _Thread_Start_m7769 (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:4701257:9)
at _Scheduler__ctor_m22217 (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:4701621:2)
任何想法!如何解决这个问题?
最佳答案
错误消息中的关键行是这一行:
at _pthread_create (http://localhost:8888/Development/WebGL_Unity_V.5.0.2.js:10991:59)
WebGL 尚不支持线程。在未来的某个时候,浏览器可能会支持 WebGL 的线程。但目前,您需要在 WebGL 中使用不需要线程的代码路径。
关于unity-game-engine - 在 MAMP 本地主机上运行 Unity WebGL 构建时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31834976/