Skip to content

Instantly share code, notes, and snippets.

@yCatDev
Created May 1, 2023 07:20
Show Gist options
  • Save yCatDev/0a0323b97babcb16d301357a55f577b3 to your computer and use it in GitHub Desktop.
Save yCatDev/0a0323b97babcb16d301357a55f577b3 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