Hide
ShowInInspector
Important
Enable SaintsEditor before using

Show a non-serialized target, be a field, property or a method.

This attribute allow you to edit the corresponding field like odin do. It does not use custom drawer even the type has one (Same as Odin)

// Please ensure you already have SaintsEditor enabled in your project before trying this example using SaintsField.Playa; // const [ShowInInspector] public const float MyConstFloat = 3.14f; // static [ShowInInspector] public static readonly Color MyColor = Color.green; // auto-property [ShowInInspector] public Color AutoColor { get => Color.green; set {} }

show_in_inspector

You can use it on a function to show a computed value. If parameters / return value is provided, they'll be shown too.

using SaintsField.Playa; // A function is also supported [ShowInInspector] private string Function() =>
quot;Function is supported (
{Random.Range(0, 10)})"; // Make a function like a real time calculator [ShowInInspector] private int AddCalculator(int a, int b) { return a + b; } // class, struct and unity object are supported too private class ClassType { public Transform Value; } [ShowInInspector] private ClassType GetClassType(int index) => new ClassType { Value = childrenTrans[index % childrenTrans.Length] };

A null-class can be created, edited and set to null:

// Please ensure you already have SaintsEditor enabled in your project before trying this example using SaintsField.Playa; private class MyClass { public string MyString; } [ShowInInspector] private MyClass _myClass; [ShowInInspector] private MyClass _myClassD = new MyClass { MyString = "Hi", };

An array/list can be created, edited and set to null:

using SaintsField; private class MyClass { public string MyString; public GameObject MyObj; private MyEnum _myEnum; } [ShowInInspector] private Color[] _colors = {Color.red, Color.green, Color.blue}; [ShowInInspector, Ordered] private Color[] _colorEmptyArray; [Button, Ordered] private void ArrayChange0ToRed() { _colorEmptyArray[0] = Color.red; } [ShowInInspector, Ordered] private MyClass[] _myClasses;

It can also create/edit an interface. Depending on the actual type is Unity Object or general class/struct, it'll show object picker or field editor accordingly.

public class GeneralDummyClass: IDummy { public string GetComment() { return "DummyClass"; } public int MyInt { get; set; } public int GenDumInt; public string GenDumString; } [ShowInInspector] private static IDummy _dummy; [Button] private void DebugDummy() => Debug.Log(_dummy);

dictionary/IReadOnlyDictionary is now supported

[ShowInInspector] private Dictionary<string, int> _myDictionaryNull; [Button] private void DictExternalAdd() { _myDictionaryNull["External"] = 1; }

Supported Attributes: ShowInInspector can work together with many attributes, please see each attribute section to know if it's been supported.