Created
May 1, 2023 07:20
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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