Fix IL2CPP incompatibility.
This commit is contained in:
24
Assets/MsvcStdextWorkaround.cs
Normal file
24
Assets/MsvcStdextWorkaround.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#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
|
11
Assets/MsvcStdextWorkaround.cs.meta
Normal file
11
Assets/MsvcStdextWorkaround.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9ed0687e714ce1042921c0057f42039f
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Reference in New Issue
Block a user