Skip to content

Commit

Permalink
-Allow non-public fields with the SerializeField attribute as custom …
Browse files Browse the repository at this point in the history
…fields for RuleTile
  • Loading branch information
ChuanXin-Unity committed Mar 26, 2021
1 parent b741f78 commit e9aebe2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Runtime/Tiles/RuleTile/RuleTile.cs
Expand Up @@ -659,8 +659,9 @@ public virtual Matrix4x4 ApplyRandomTransform(TilingRule.Transform type, Matrix4
/// <returns>Custom fields for this RuleTile</returns>
public FieldInfo[] GetCustomFields(bool isOverrideInstance)
{
return this.GetType().GetFields()
return this.GetType().GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
.Where(field => typeof(RuleTile).GetField(field.Name) == null)
.Where(field => field.IsPublic || field.IsDefined(typeof(SerializeField)))
.Where(field => !field.IsDefined(typeof(HideInInspector)))
.Where(field => !isOverrideInstance || !field.IsDefined(typeof(RuleTile.DontOverride)))
.ToArray();
Expand Down

0 comments on commit e9aebe2

Please sign in to comment.