Skip to content

Commit

Permalink
fix: error passing class with public readonly field to UI.FIeld()
Browse files Browse the repository at this point in the history
  • Loading branch information
fuqunaga committed Jan 26, 2023
1 parent 8ec6e22 commit 6b4b3fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static Func<TParent, TValue, TParent> CreateSetter(string propertyOrFieldName)
}
catch (Exception e)
{
Debug.Log(e);
Debug.LogError($"{typeof(PropertyOrFieldGetterSetter<TParent, TValue>)}.{nameof(CreateSetter)} propertyOrFieldName[{propertyOrFieldName}]\n{e}");
}

return Expression.Lambda<Func<TParent, TValue, TParent>>(block, objParam, setterValueParam).Compile();
Expand Down
7 changes: 5 additions & 2 deletions Packages/RosettaUI/Runtime/Utilities/TypeUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ public ReflectionCache(Type type, IReadOnlyCollection<FieldInfo> fis, IEnumerabl


uiTargetPropertyOrFieldsNameTypeDic = fis
.Where(fi => (fi.IsPublic && fi.GetCustomAttribute<NonSerializedAttribute>() == null)
|| fi.GetCustomAttribute<SerializeField>() != null)
.Where(fi => !fi.IsInitOnly)
.Where(fi =>
(fi.IsPublic && fi.GetCustomAttribute<NonSerializedAttribute>() == null)
|| fi.GetCustomAttribute<SerializeField>() != null
)
.ToDictionary(fi => fi.Name, fi => fi.FieldType);
}

Expand Down

0 comments on commit 6b4b3fe

Please sign in to comment.