Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yangpei1010110/bb1ed9757990d3a5abe1088f118f2f0a to your computer and use it in GitHub Desktop.
Save yangpei1010110/bb1ed9757990d3a5abe1088f118f2f0a to your computer and use it in GitHub Desktop.
Script that enables Full Generic Sharing by default for all builds for Unity 2021
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
public class CppBuildPreprocessing : IPreprocessBuildWithReport
{
public int callbackOrder
{
get { return 0; }
}
public void OnPreprocessBuild(BuildReport report)
{
string addlArgs = "--generics-option=None,EnableFullSharing";
UnityEngine.Debug.Log(
$"Setting Additional IL2CPP Args = \"{addlArgs}\" for platform {report.summary.platform}");
PlayerSettings.SetAdditionalIl2CppArgs(addlArgs);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment