diff --git a/Editor/ConstValues.cs b/Editor/ConstValues.cs index efd1ada..54407e1 100644 --- a/Editor/ConstValues.cs +++ b/Editor/ConstValues.cs @@ -1,4 +1,6 @@ -namespace Obfuz.Editor +using System.Text; + +namespace Obfuz.Editor { public static class ConstValues { @@ -19,5 +21,7 @@ public const string ZluaLuaInvokeAttributeFullName = "Zlua.LuaInvokeAttribute"; public const string ZluaLuaCallbackAttributeFullName = "Zlua.LuaCallbackAttribute"; public const string ZluaLuaMarshalAsAttributeFullName = "Zlua.LuaMarshalAsAttribute"; + + public const string BurstCompileFullName = "Unity.Burst.BurstCompileAttribute"; } } diff --git a/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs b/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs index ed0f7bf..68d4ea2 100644 --- a/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs +++ b/Editor/ObfusPasses/SymbolObfus/Policies/SystemRenamePolicy.cs @@ -23,6 +23,7 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies ConstValues.ZluaLuaInvokeAttributeFullName, ConstValues.ZluaLuaCallbackAttributeFullName, ConstValues.ZluaLuaMarshalAsAttributeFullName, + ConstValues.BurstCompileFullName, }; diff --git a/Editor/ObfuscationMethodWhitelist.cs b/Editor/ObfuscationMethodWhitelist.cs index 79ef34f..35ba6df 100644 --- a/Editor/ObfuscationMethodWhitelist.cs +++ b/Editor/ObfuscationMethodWhitelist.cs @@ -63,6 +63,10 @@ namespace Obfuz { return true; } + if (method.CustomAttributes.Find(ConstValues.BurstCompileFullName) != null) + { + return true; + } // don't obfuscate cctor when it has RuntimeInitializeOnLoadMethodAttribute with load type AfterAssembliesLoaded if (method.IsStatic && method.Name == ".cctor" && typeDef.Methods.Any(m => DoesMethodContainsRuntimeInitializeOnLoadMethodAttributeAndLoadTypeGreaterEqualAfterAssembliesLoaded(m))) @@ -82,6 +86,10 @@ namespace Obfuz { return true; } + if (type.CustomAttributes.Find(ConstValues.BurstCompileFullName) != null) + { + return true; + } if (_obfuzComputeCache.HasSelfOrDeclaringOrEnclosingOrInheritObfuzIgnoreScope(type, type.DeclaringType, ObfuzScope.TypeName)) { return true;