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

文章目录

  • 错误日志
  • 可能的原因及解决办法:
    • 导出路径不能有中文
    • [系统名(win)含有中文, 修改环境变量Temp和Tmp, 如下图:](#系统名(win)含有中文, 修改环境变量Temp和Tmp, 如下图:)
    • [真正的原因: 杀毒软件删除了部分wasm相关文件,如:](#真正的原因: 杀毒软件删除了部分wasm相关文件,如:)

错误日志

复制代码
Building Library\Bee\artifacts\WebGL\build\debug_WebGL_wasm\build.js failed with output:
emcc2: error: '"C:/Program Files/Unity/Hub/Editor/2021.3.6f1/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/binaryen\bin\wasm-metadce" --graph-file=C:\Temp\tmp8sp_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
相关推荐
烛阴5 小时前
Mix
前端·webgl
死也不注释6 小时前
【鸡零狗碎记录】
unity·c#
★YUI★10 小时前
学习游戏制作记录(剑投掷技能)7.26
学习·游戏·unity·c#
★YUI★1 天前
学习游戏制作记录(克隆技能)7.25
学习·游戏·unity·c#
烛阴1 天前
Tile Pattern
前端·webgl
不绝1911 天前
ARPG开发流程第一章——方法合集
算法·游戏·unity·游戏引擎
玩代码1 天前
Unity里的加力
开发语言·unity
贵州晓智信息科技1 天前
Unity 性能优化全攻略
unity·性能优化·游戏引擎
UWA2 天前
UWA DAY 2025 游戏开发者大会|全议程
游戏·unity·性能优化·游戏开发·uwa·unreal engine
unicrom_深圳市由你创科技2 天前
Unity 的UI动画调节
ui·unity·游戏引擎