Unity 3D 在Build的时候最后卡住了,弹出如下提示,打开下边的详情会发现错误名称是CLR20r3的错误。
打开Unity最下边会发现如下错误日志:
Failed running C:\Program Files\Unity\Editor\Data\il2cpp/build/il2cpp.exe --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="WindowsDesktop" --architecture="x64" --configuration="Release" --outputpath="C:\Workspace\Unity\SnowTest\Temp/StagingArea/Data\Native\GameAssembly.dll" --cachedirectory="C:\Workspace\Unity\SnowTest\Assets\..\Library/il2cpp_cache" --map-file-parser="C:\Program Files\Unity\Editor\Data\Tools\MapFileParser\MapFileParser.exe" --assembly="C:\Workspace\Unity\SnowTest\Temp\StagingArea\Data\Managed\UnityEngine.dll" --generatedcppdir="C:\Workspace\Unity\SnowTest\Temp\StagingArea\Data\il2cppOutput"
stdout:
il2cpp.exe didn't catch exception: System.InvalidOperationException: C++ code builder is unable to build C++ code. In order to build C++ code for Windows Desktop, you must have one of these installed:
Visual Studio 2010 with C++ compilers and Windows 7 SDK (it cannot build C++ code because it is not installed)
Visual Studio 2010 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\10.0_Config\InstallDir" in the registry
Windows 7 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A\InstallationFolder" in the registry
Visual Studio 2013 with C++ compilers and Windows 8.1 SDK (it cannot build C++ code because it is not installed)
Visual Studio 2013 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\12.0_Config\InstallDir" in the registry
Windows 8.1 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1\InstallationFolder" in the registry
Visual Studio 2015 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
Visual Studio 2015 installation is found by looking at "SOFTWARE\Microsoft\VisualStudio\14.0_Config\InstallDir" in the registry
Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
Visual Studio 2017 with C++ compilers and Windows 10 SDK (it cannot build C++ code because it is not installed)
Visual Studio 2017 installation is found using Microsoft.VisualStudio.Setup.Configuration COM APIs
Windows 10 SDK is found by looking at "SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0\InstallationFolder" in the registry
解决方式
尝试Visual Studio Community 2019,工作负载->使用C++的桌面开发 勾选后,点击安装。IL2Cpp编译成功并运行。
具体操作我是在另外一篇帖子里找的,地址如下:
https://blog.csdn.net/shulianghan/article/details/112645077
另外我还参考了另外一篇帖子:
https://blog.csdn.net/weixin_33778778/article/details/91595176
|