This question was [asked in 2017][1] with no movement. I've been unable to find any resources on the topic. So I apologize for the duplication.
As I commented in the old thread. I currently have a bunch of code in c#, swift, and c that rely all on the same preprocessor being defined. It seems silly and error prone to have to manually go into XCode and set the build flags again. I don't have these issue on Android build.
Is there a way from Unity, programmatically, to take the pre defined preprocessor macro, which I set in Unity with this static method,
private static void SetBuildMacroForGroup(BuildTargetGroup group, string buildMacro) {
PlayerSettings.GetScriptingDefineSymbolsForGroup(group, out var macros);
if (macros.Any(macro => macro == buildMacro)) {
return;
}
var enumerable = macros.Append(buildMacro);
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, enumerable.ToArray());
}
and ensure that the same macro ends up as a build macro in xcode so that iOS plugin files only compile certain code if and only if the macro is defined, exactly how it works inside the Unity Engine?
[1]: https://answers.unity.com/questions/1398113/setscriptingdefinesymbolsforgroup.html?childToView=1919555#answer-1919555
↧