当我尝试构建我的项目时(我曾尝试为 Android 和通用 Windows 平台构建),由于 MINUS SIGN (U+2212)
构建失败在生成的 C++ 中用作负号的字符。我在 Unity 2020.2/Android 11 SDK/GPGS 10;我使用 Unity 2019/Android 10 SDK/GPGS 9 成功构建。
我在所有 asset
中都搜索了“-”(和“2212”作为很好的衡量标准) , cs
, meta
, prefab
, txt
, unity
, 和 xml
项目中的文件并没有发现任何东西(除了巧合的文件 ID 616832212
、 Sprite ID 9561e3c67a82d7f448852212eb8fac6b
和技术上匹配的二进制文件)。我还尝试让 Unity 重新安装软件包并重建 Library
;没运气。
对于 UWP 构建,我打开了 [build output directory]\Il2CppOutputProject\Source\il2cppOutput\Generic8.cpp
并确认“-”字符以这种方式重复出现在文件中——例如,
19990:IL_0063:
19991: {
19992: return (int32_t)(−1);
19993: }
19994:}
Android 构建的错误是:Exception: Unity.IL2CPP.Building.BuilderFailedException: C:\[path to project folder]\Library\Il2cppBuildCache\Android\armeabi-v7a\il2cppOutput\Assembly-CSharp.cpp:20814:155: warning: treating Unicode character <U+2212> as identifier character rather than as '-' symbol [-Wunicode-homoglyph]
AndroidClient_InvokeCallbackOnGameThread_TisUIStatus_t34F64DC1927A392210216047169D4E196183BD14_m78B26B077A1A979B11C5596B45DC6E9A1A2929B6(L_1, ((int32_t)<U+2212>3), /*hidden argument*/AndroidClient_InvokeCallbackOnGameThread_TisUIStatus_t34F64DC1927A392210216047169D4E196183BD14_m78B26B077A1A979B11C5596B45DC6E9A1A2929B6_RuntimeMethod_var);
^~~~~~~~
C:\[path to project folder]\Library\Il2cppBuildCache\Android\armeabi-v7a\il2cppOutput\Assembly-CSharp.cpp:20814:155: error: non-ASCII characters are not allowed outside of literals and identifiers
AndroidClient_InvokeCallbackOnGameThread_TisUIStatus_t34F64DC1927A392210216047169D4E196183BD14_m78B26B077A1A979B11C5596B45DC6E9A1A2929B6(L_1, ((int32_t)<U+2212>3), /*hidden argument*/AndroidClient_InvokeCallbackOnGameThread_TisUIStatus_t34F64DC1927A392210216047169D4E196183BD14_m78B26B077A1A979B11C5596B45DC6E9A1A2929B6_RuntimeMethod_var);
^~~~~~~~
(然后同样的事情继续重复几十个实例。)
最佳答案
我遇到了同样的问题,切换到英国(从瑞典)解决了它
(不是物理上的,在系统设置中更改:语言/区域)
关于unity3d - Unity 在生成的 C++ 中使用 “−” (U+2212) 作为负号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65429190/