unity2d转微信小程序报错

Posted 程序媛堆堆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了unity2d转微信小程序报错相关的知识,希望对你有一定的参考价值。

报错


Building Library\\Bee\\artifacts\\WebGL\\build\\debug_WebGL_wasm\\build.js failed with output:
Traceback (most recent call last):
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\emcc2.py”, line 3571, in
sys.exit(main(sys.argv))
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\emcc2.py”, line 3564, in main
ret = run(args)
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\emcc2.py”, line 1082, in run
phase_post_link(options, wasm_target, wasm_target, target)
File “D:\\obj\\windows-release\\37amd64_Release\\msi_python\\zip_amd64\\contextlib.py”, line 74, in inner
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\emcc2.py”, line 2400, in phase_post_link
phase_emscript(options, in_wasm, wasm_target, memfile)
File “D:\\obj\\windows-release\\37amd64_Release\\msi_python\\zip_amd64\\contextlib.py”, line 74, in inner
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\emcc2.py”, line 2428, in phase_emscript
emscripten.run(in_wasm, wasm_target, final_js, memfile)
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\emscripten.py”, line 830, in run
emscript(in_wasm, out_wasm, outfile_js, memfile, shared.DEBUG)
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\emscripten.py”, line 308, in emscript
glue, forwarded_data = compile_settings()
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\emscripten.py”, line 178, in compile_settings
cwd=path_from_root(‘src’), env=env)
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\tools\\shared.py”, line 216, in run_js_tool
return check_call(command, *args, **kw).stdout
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\tools\\shared.py”, line 202, in check_call
return run_process(cmd, *args, **kw)
File “D:\\Unity\\2021.3.4f1c1\\Editor\\Data\\PlaybackEngines\\WebGLSupport\\BuildTools\\Emscripten\\emscripten\\tools\\shared.py”, line 97, in run_process
ret = subprocess.run(cmd, check=check, input=input, *args, **kw)
File “D:\\obj\\windows-release\\37amd64_Release\\msi_python\\zip_amd64\\subprocess.py”, line 474, in run
File “D:\\obj\\windows-release\\37amd64_Release\\msi_python\\zip_amd64\\subprocess.py”, line 926, in communicate
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa4 in position 471314: illegal multibyte sequence
UnityEditor.BuildPipeline:BuildPlayer (string[],string,UnityEditor.BuildTarget,UnityEditor.BuildOptions)
WeChatWASM.WXEditorWindow:Build () (at Assets/WX-WASM-SDK/Editor/WXEditorWindow.cs:343)
WeChatWASM.WXEditorWindow:DoExport (bool) (at Assets/WX-WASM-SDK/Editor/WXEditorWindow.cs:1331)
WeChatWASM.WXEditorWindow:OnGUI () (at Assets/WX-WASM-SDK/Editor/WXEditorWindow.cs:1259)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

原因

打包前插件提示可以更新,于是在并未卸载20220915版本的前提下,直接导入了20220923版本

解决方法

在项目目录/Assets/下,找到WX-WASM-SDK删掉。然后重新导入工具包,此处我导入的是原来那个版本,并未导入下载的新版本

以上是关于unity2d转微信小程序报错的主要内容,如果未能解决你的问题,请参考以下文章

如何玩转微信小程序

Android App跳转微信小程序

H5跳转微信小程序

玩转微信小程序

抖音跳转微信小程序方法有哪些

去哪儿网React转微信小程序实践