fix: 修复 UnityRenamePolicy::NeedRename(MethodDef)错误地判定当前类型为MonoBehaviour类脚本,如果不是事件函数就直接返回,没有尝试后续检查的bug

before-split
walon 2025-05-23 09:24:24 +08:00
parent e19dbe1dc8
commit 3fe3a6b302
1 changed files with 2 additions and 2 deletions

View File

@ -163,9 +163,9 @@ namespace Obfuz.ObfusPasses.SymbolObfus.Policies
public override bool NeedRename(MethodDef methodDef) public override bool NeedRename(MethodDef methodDef)
{ {
TypeDef typeDef = methodDef.DeclaringType; TypeDef typeDef = methodDef.DeclaringType;
if (MetaUtil.IsInheritFromUnityObject(typeDef)) if (MetaUtil.IsInheritFromUnityObject(typeDef) && s_monoBehaviourEvents.Contains(methodDef.Name))
{ {
return !s_monoBehaviourEvents.Contains(methodDef.Name); return false;
} }
if (MetaUtil.HasRuntimeInitializeOnLoadMethodAttribute(methodDef)) if (MetaUtil.HasRuntimeInitializeOnLoadMethodAttribute(methodDef))
{ {