Attribute that can be used to make class member that follows the attribute be shown in the inspector.
Unlike Unity’s built-in SerializeField and SerializeReference attributes this can also be used to display non-serialized fields. It also supports exposing properties and methods in addition to fields.
For more information see the display anything feature page.
Note: fields are not automatically serialized even if this attribute is used as it only affects visibility!
If you also want the field to be serialized use the SerializeReference attribute.
Attribute Target
Field, property, method or indexer.
Example
using UnityEngine; using Sisus.Attributes; public class TestShowInInspector : MonoBehaviour { [ShowInInspector] private bool nonSerializedFieldSupport = true; [ShowInInspector] public bool PropertySupport { get { return true; } set { Debug.Log((value ? "Correct." : "Incorrect.") + " Properties are supported."); } } [ShowInInspector] public bool GetOnlyPropertySupport { get; } = true; [ShowInInspector] public bool SetOnlyPropertySupport { set { Debug.Log((value ? "Correct." : "Incorrect.") + " Set Only Properties are supported."); } } [ShowInInspector] private bool Method() { return true; } [ShowInInspector] private static bool ExposedStaticMethod() { return true; } [ShowInInspector] private static bool ExposedMethodWithParameters(bool isSupported = true) { Debug.Log((isSupported ? "Correct." : "Incorrect.") + " Methods with parameters are supported."); return true; } }
Example Result
See Also: Button