- Home /
SetScriptingDefineSymbolsForGroup working is strange
My app crashed by "UNITY_DEBUG" define.
In some situation, "UNITY_DEBUG" define is not applied while generate methods_pointedto_by_uievents.xml.
(I guess methods_pointedto_by_uievents.xml was related Unity Inspector logic)
It occured when first build without "UNITY_DEBUG" define and then next build with "UNITY_DEBUG" define.
I use "SetScriptingDefineSymbolsForGroup" API before call "BuildPipeline.BuildPlayer.
Following is pseduo code and test steps.
Step 1. build "Release"
[AutoBuilder.cs]
// Apply Defines
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "SOME_DEFINES");
// Run Build
BuildPipeline.BuildPlayer(GetScenePaths(), buildTargetPath, BuildTarget.Android, options);
Step 2. build "Debug"
[AutoBuilder.cs]
// Apply Defines
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "UNITY_DEBUG;SOME_DEFINES");
// Run Build
BuildPipeline.BuildPlayer(GetScenePaths(), buildTargetPath, BuildTarget.Android, options);
Step 3. run my app created in Step 2.
Crash! It caused by nothing functions definition about UNITY_DEBUG define in methods_pointedto_by_uievents.xml (see attached under image)
Following is pseduo code of the functions
[DebugMgr.cs / class DebugMgr]
#if UNITY_DEBUG
public void ShareMail()
{
}
public void ShowNativeShare()
{
}
... ...
#endif
Left side is methods_pointedto_by_uievents.xml of good.(debug)
Right side is methods_pointedto_by_uievents.xml of crashed.(also debug)
There is no functions of "DebugMgr(under UNITY_DEBUG define)" and caused by it.
but, once again build debug mode, the "DebugMgr" code generated in methods_pointedto_by_uievents.xml (Left side)
In summary
Release build -> Debug build -> Crashd! (Right side)
Release build -> Debug build -> Debug build -> fine. (Left side)
I suspect that apply of SetScriptingDefineSymbolsForGroup is too late.
I think SetScriptingDefineSymbolsForGroup is applied after methods_pointedto_by_uievents.xml is created.
Let me know what the problem in my project is?
Is it not safe to use SetScriptingDefineSymbolsForGroup?
Shoud i use way of modify mcs.rsp?
What is guide that recommend in build unity3d projects?