breaking: InspectorHelper.IsSyncObject made universal as ImplementsInterface<T>

This commit is contained in:
vis2k 2021-09-25 16:08:34 +08:00
parent ab78c858da
commit 323b357a94
2 changed files with 3 additions and 3 deletions

View File

@ -57,9 +57,9 @@ public static bool IsVisibleField(this FieldInfo field)
return field.IsPublic || IsSerializeField(field);
}
public static bool IsSyncObject(this FieldInfo field)
public static bool ImplementsInterface<T>(this FieldInfo field)
{
return typeof(SyncObject).IsAssignableFrom(field.FieldType);
return typeof(T).IsAssignableFrom(field.FieldType);
}
public static bool HasShowInInspector(this FieldInfo field)

View File

@ -31,7 +31,7 @@ public SyncObjectDrawer(UnityEngine.Object targetObject)
syncObjectFields = new List<SyncObjectField>();
foreach (FieldInfo field in InspectorHelper.GetAllFields(targetObject.GetType(), typeof(NetworkBehaviour)))
{
if (field.IsSyncObject() && field.IsVisibleSyncObject())
if (field.ImplementsInterface<SyncObject>() && field.IsVisibleSyncObject())
{
syncObjectFields.Add(new SyncObjectField(field));
}