/// <inheritdoc/> protected internal override void Initialize() { if (InspectedObject == null) { LoadResource(); } if (InspectedObject != null) { int currentIndex = 0; SerializableObject serializableObject = new SerializableObject(InspectedObject.GetType(), InspectedObject); foreach (var field in serializableObject.Fields) { if (!field.Inspectable) { continue; } string path = field.Name; InspectableField inspectableField = InspectableField.CreateInspectable(this, field.Name, path, currentIndex, 0, new InspectableFieldLayout(Layout), field.GetProperty(), InspectableFieldStyle.Create(field)); inspectableFields.Add(inspectableField); isEmpty = false; currentIndex += inspectableField.GetNumLayoutElements(); } base.SetVisible(!isEmpty); } }
/// <inheritdoc/> protected internal override void Initialize() { if (InspectedObject == null) { LoadResource(); } if (InspectedObject != null) { SerializableObject serializableObject = new SerializableObject(InspectedObject.GetType(), InspectedObject); inspectableFields = InspectableField.CreateFields(serializableObject, this, "", 0, Layout); isEmpty = inspectableFields.Count > 0; base.SetVisible(!isEmpty); } }
//protected List<FieldInfo> Fields { get; set; } protected virtual void OnEnable() { InspectedObject = serializedObject.targetObject; InspectedType = InspectedObject.GetType(); Properties = InspectedType .GetProperties(BindingFlags.Public | BindingFlags.Instance) .Where(property => property.DeclaringType == InspectedType) .Where(property => (property.SetMethod?.IsPublic).GetValueOrDefault()) .ToList(); //Fields = InspectedType // .GetFields(BindingFlags.Public | BindingFlags.Instance) // .Concat(InspectedType // .GetFields(BindingFlags.NonPublic | BindingFlags.Instance) // .Where(field => field.GetCustomAttribute<SerializeField>() != null) // ) // .Where(field => field.IsInitOnly == false) // .ToList(); }