赞
踩
Unity3D错误提示:
Unity论坛的解决办法:
Unity 2022.1.22f1 with IL2CPP not working
IL2CPP error on Building for Windows
Workaround for building with IL2CPP with Visual Studio 2022 17.4
方法一:修改环境变量(我的电脑 -> 属性 -> 环境变量)
变量名: _CL_
变量值: /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
方法二:Unity新建脚本,复制粘贴下列代码,打包即可。
#if UNITY_EDITOR using System; using UnityEditor.Build; using UnityEditor.Build.Reporting; public class MsvcStdextWorkaround : IPreprocessBuildWithReport { const string kWorkaroundFlag = "/D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS"; public int callbackOrder => 0; public void OnPreprocessBuild(BuildReport report) { var clEnv = Environment.GetEnvironmentVariable("_CL_"); if (string.IsNullOrEmpty(clEnv)) { Environment.SetEnvironmentVariable("_CL_", kWorkaroundFlag); } else if (!clEnv.Contains(kWorkaroundFlag)) { clEnv += " " + kWorkaroundFlag; Environment.SetEnvironmentVariable("_CL_", clEnv); } } } #endif // UNITY_EDITOR
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。