Table of Contents

Class PropertyModel

Namespace
Plugins.Saneject.Editor.Inspectors.Models
Assembly
Saneject.Editor.dll

Encapsulates metadata and state for a serializable property in the custom Saneject inspector. This model combines reflection information about a field with its serialized property representation, handling special cases like SerializeInterfaceAttribute fields, nested serializable types, injected fields, and read-only properties. It supports hierarchical property structures for nested types and collections.

public sealed class PropertyModel
Inheritance
object
PropertyModel

Constructors

PropertyModel(SerializedObject, FieldInfo, SerializedProperty)

Initializes a new instance of the PropertyModel class.

public PropertyModel(SerializedObject root, FieldInfo field, SerializedProperty parent = null)

Parameters

root SerializedObject

The root UnityEditor.SerializedObject used to find top-level properties.

field FieldInfo

The FieldInfo representing the property.

parent SerializedProperty

The parent SerializedProperty if this property is nested within another serializable type. If null, the property is resolved from the root UnityEditor.SerializedObject.

Properties

Children

Gets the read-only collection of child PropertyModel instances for nested serializable types. Empty if this property is not a nested serializable type or if no children are found.

public IReadOnlyList<PropertyModel> Children { get; }

Property Value

IReadOnlyList<PropertyModel>

DisplayName

Gets the display name for this property in the inspector, nicified and with type information for SerializeInterfaceAttribute fields.

public string DisplayName { get; }

Property Value

string

ExpectedType

Gets the expected element type for this property. For SerializeInterfaceAttribute fields, this is the interface type. For non-interface properties, this is the field type itself.

public Type ExpectedType { get; }

Property Value

Type

HasInjectAttribute

Gets a value indicating whether this property is marked with the InjectAttribute attribute.

public bool HasInjectAttribute { get; }

Property Value

bool

IsCollection

Gets a value indicating whether this property is an array or list type.

public bool IsCollection { get; }

Property Value

bool

IsReadOnly

Gets a value indicating whether this property should be drawn as read-only in the inspector. This is true if the field is marked with InjectAttribute or ReadOnlyAttribute .

public bool IsReadOnly { get; }

Property Value

bool

IsSerializedInterface

Gets a value indicating whether this property is marked with the SerializeInterfaceAttribute attribute.

public bool IsSerializedInterface { get; }

Property Value

bool

SerializedProperty

Gets the serialized property representation of this field.

public SerializedProperty SerializedProperty { get; }

Property Value

SerializedProperty