mirror of
https://github.com/AnnulusGames/Alchemy.git
synced 2025-01-22 08:18:51 -05:00
Fix: fields that hides inherited properties appears multiple times
This commit is contained in:
parent
6800d3a455
commit
aff108be38
@ -211,7 +211,11 @@ namespace Alchemy.Editor
|
||||
break;
|
||||
case FieldInfo:
|
||||
case PropertyInfo:
|
||||
if (memberInfo.IsPublic() || memberInfo.HasCustomAttribute<SerializeField>())
|
||||
var isSerializedMember = false;
|
||||
if (memberInfo is FieldInfo f) isSerializedMember = f.IsPublic | f.HasCustomAttribute<SerializeField>();
|
||||
else if (memberInfo is PropertyInfo p) isSerializedMember = p.HasCustomAttribute<SerializeField>();
|
||||
|
||||
if (isSerializedMember)
|
||||
{
|
||||
var property = findPropertyFunc?.Invoke(memberInfo.Name);
|
||||
|
||||
|
@ -15,16 +15,5 @@ namespace Alchemy.Editor
|
||||
result = memberInfo.GetCustomAttribute<T>();
|
||||
return result != null;
|
||||
}
|
||||
|
||||
public static bool IsPublic(this MemberInfo memberInfo)
|
||||
{
|
||||
switch (memberInfo)
|
||||
{
|
||||
case MethodInfo methodInfo: return methodInfo.IsPublic;
|
||||
case FieldInfo fieldInfo: return fieldInfo.IsPublic;
|
||||
case PropertyInfo propertyInfo: return propertyInfo.GetMethod != null && propertyInfo.GetMethod.IsPublic && propertyInfo.SetMethod != null && propertyInfo.SetMethod.IsPublic;
|
||||
default: throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user