Ignore readonly fields

This commit is contained in:
TsFreddie 2024-06-12 13:16:25 +08:00 committed by VladV
parent 0c5b8f4480
commit 6c844f0b69

View File

@ -14,6 +14,11 @@ namespace TriInspector.Utilities
public static bool IsSerializableByUnity(FieldInfo fieldInfo) public static bool IsSerializableByUnity(FieldInfo fieldInfo)
{ {
if (fieldInfo.IsInitOnly)
{
return false;
}
if (fieldInfo.GetCustomAttribute<NonSerializedAttribute>() != null || if (fieldInfo.GetCustomAttribute<NonSerializedAttribute>() != null ||
fieldInfo.GetCustomAttribute<HideInInspector>() != null) fieldInfo.GetCustomAttribute<HideInInspector>() != null)
{ {