Unity WebGL 编译 报错: emcc2: error: ‘*‘ failed: [WinError 2] ϵͳ�Ҳ���ָ�����ļ���解决办法

错误日志

Building LibraryBeeartifactsWebGLbuilddebug_WebGL_wasmbuild.js failed with output:
emcc2: error: '"C:/Program Files/Unity/Hub/Editor/2021.3.6f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/binaryenbinwasm-metadce" --graph-file=C:Temptmp8sp_k84m.txt Library/Bee/artifacts/WebGL/build/debug_WebGL_wasm/build.wasm -o Library/Bee/artifacts/WebGL/build/debug_WebGL_wasm/build.wasm --mvp-features' failed: [WinError 2] ϵͳ�Ҳ���ָ�����ļ���
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <44a70d1b13cf47e29810e30f45ffae08>:0)
UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:158)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <44a70d1b13cf47e29810e30f45ffae08>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <44a70d1b13cf47e29810e30f45ffae08>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Build completed with a result of 'Failed' in 128 seconds (128027 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <44a70d1b13cf47e29810e30f45ffae08>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <44a70d1b13cf47e29810e30f45ffae08>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

可能的原因及解决办法:

导出路径不能有中文

系统名(win)含有中文, 修改环境变量Temp和Tmp, 如下图:

修改环境变量

真正的原因: 杀毒软件删除了部分wasm相关文件,如:

*/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/binaryen/bin/wasm-metadce.exe
*/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/binaryen/bin/wasm-emscripten-finalize.exe

解决办法(二选一):

  1. 找到文件并还原到原位置
  2. 重装Editor
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>