Table of Contents

Class SanejectInspector

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

Provides UI drawing and validation logic for the custom Saneject inspector. Handles rendering of serialized properties with injection-aware read-only states, custom handling for SerializeInterfaceAttribute fields, nested serializable types, and validation to ensure assigned objects implement expected interface types.

public static class SanejectInspector
Inheritance
object
SanejectInspector

Methods

DrawMonoBehaviourScriptField(Object)

Draws the default script field at the top of a UnityEngine.MonoBehaviour inspector.

public static void DrawMonoBehaviourScriptField(Object target)

Parameters

target Object

The target object. If not a UnityEngine.MonoBehaviour, this method returns without drawing anything.

DrawProperty(PropertyModel)

Draws a single property with the given display name and read-only state, handling foldouts for nested serializable types.

public static void DrawProperty(PropertyModel model)

Parameters

model PropertyModel

The property model to draw.

GetFieldInfosForInspector(Type)

Collects all drawable System.Reflection.FieldInfo of the type, including base classes.

public static IEnumerable<FieldInfo> GetFieldInfosForInspector(this Type type)

Parameters

type Type

Returns

IEnumerable<FieldInfo>

HasInjectAttribute(FieldInfo)

Returns true if the field is marked with InjectAttribute.

public static bool HasInjectAttribute(this FieldInfo field)

Parameters

field FieldInfo

Returns

bool

HasReadOnlyAttribute(FieldInfo)

Returns true if the field is marked with ReadOnlyAttribute.

public static bool HasReadOnlyAttribute(this FieldInfo field)

Parameters

field FieldInfo

Returns

bool

IsSerializeInterface(FieldInfo)

Returns true if the field is marked with SerializeInterfaceAttribute.

public static bool IsSerializeInterface(this FieldInfo field)

Parameters

field FieldInfo

Returns

bool

OnInspectorGUI(ComponentModel)

Draws the complete default Saneject UnityEngine.MonoBehaviour inspector, including the script field, all serializable fields and interfaces in declaration order, injection-aware read-only handling, custom UI and validation for SerializeInterfaceAttribute fields, and recursive drawing of nested serializable types.

public static void OnInspectorGUI(ComponentModel componentModel)

Parameters

componentModel ComponentModel

The component model containing the target object and its inspectable properties.

ValidateProperty(PropertyModel)

Validates that the field is assigned to an object that implements the expected type. For SerializeInterfaceAttribute fields, validates each element if the property is a collection, or the single value if not. Also recursively validates child properties.

public static void ValidateProperty(PropertyModel property)

Parameters

property PropertyModel

The property model to validate.