diff --git a/Nino_Unity/Assets/Nino/Serialization/TypeModel.cs b/Nino_Unity/Assets/Nino/Serialization/TypeModel.cs index f9de671..164af57 100644 --- a/Nino_Unity/Assets/Nino/Serialization/TypeModel.cs +++ b/Nino_Unity/Assets/Nino/Serialization/TypeModel.cs @@ -289,14 +289,6 @@ internal static TypeModel CreateModel(Type type) if (ig.Length > 0) continue; } - //has to have getter and setter - if (!(p.CanRead && p.CanWrite)) - { - if (model.IncludeAll) continue; - throw new InvalidOperationException( - $"Cannot read or write property {p.Name} in {type.FullName}, cannot Serialize or Deserialize this property"); - } - if (model.IncludeAll) { index++; @@ -306,6 +298,14 @@ internal static TypeModel CreateModel(Type type) ns = p.GetCustomAttributes(NinoMemberType, true); //not fetch all and no attribute => skip this member if (ns.Length != 1) continue; + + //has to have getter and setter + if (!(p.CanRead && p.CanWrite)) + { + if (model.IncludeAll) continue; + throw new InvalidOperationException( + $"Cannot read or write property {p.Name} in {type.FullName}, cannot Serialize or Deserialize this property"); + } index = ((NinoMemberAttribute)ns[0]).Index; } diff --git a/src/Nino.Serialization/TypeModel.cs b/src/Nino.Serialization/TypeModel.cs index f9de671..164af57 100644 --- a/src/Nino.Serialization/TypeModel.cs +++ b/src/Nino.Serialization/TypeModel.cs @@ -289,14 +289,6 @@ internal static TypeModel CreateModel(Type type) if (ig.Length > 0) continue; } - //has to have getter and setter - if (!(p.CanRead && p.CanWrite)) - { - if (model.IncludeAll) continue; - throw new InvalidOperationException( - $"Cannot read or write property {p.Name} in {type.FullName}, cannot Serialize or Deserialize this property"); - } - if (model.IncludeAll) { index++; @@ -306,6 +298,14 @@ internal static TypeModel CreateModel(Type type) ns = p.GetCustomAttributes(NinoMemberType, true); //not fetch all and no attribute => skip this member if (ns.Length != 1) continue; + + //has to have getter and setter + if (!(p.CanRead && p.CanWrite)) + { + if (model.IncludeAll) continue; + throw new InvalidOperationException( + $"Cannot read or write property {p.Name} in {type.FullName}, cannot Serialize or Deserialize this property"); + } index = ((NinoMemberAttribute)ns[0]).Index; }