mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
fix: androidCreateSymbols has been deprecated (#701)
This commit is contained in:
parent
0b822c28fb
commit
9cd9f7e0e7
@ -74,7 +74,20 @@ namespace UnityBuilderAction.Input
|
||||
string symbolType;
|
||||
if (options.TryGetValue("androidSymbolType", out symbolType) && !string.IsNullOrEmpty(symbolType))
|
||||
{
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
switch (symbolType)
|
||||
{
|
||||
case "public":
|
||||
SetDebugSymbols("SymbolTable");
|
||||
break;
|
||||
case "debugging":
|
||||
SetDebugSymbols("Full");
|
||||
break;
|
||||
case "none":
|
||||
SetDebugSymbols("None");
|
||||
break;
|
||||
}
|
||||
#elif UNITY_2021_1_OR_NEWER
|
||||
switch (symbolType)
|
||||
{
|
||||
case "public":
|
||||
@ -101,5 +114,35 @@ namespace UnityBuilderAction.Input
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetDebugSymbols(string enumValueName)
|
||||
{
|
||||
// UnityEditor.Android.UserBuildSettings and Unity.Android.Types.DebugSymbolLevel are part of the Unity Android module.
|
||||
// Reflection is used here to ensure the code works even if the module is not installed.
|
||||
|
||||
var debugSymbolsType = Type.GetType("UnityEditor.Android.UserBuildSettings+DebugSymbols, UnityEditor.Android.Extensions");
|
||||
if (debugSymbolsType == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var levelProp = debugSymbolsType.GetProperty("level", BindingFlags.Static | BindingFlags.Public);
|
||||
if (levelProp == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var enumType = Type.GetType("Unity.Android.Types.DebugSymbolLevel, Unity.Android.Types");
|
||||
if (enumType == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(enumType, enumValueName, false , out var enumValue))
|
||||
{
|
||||
return;
|
||||
}
|
||||
levelProp.SetValue(null, enumValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user