Version 2.1.0.0

Odin has a dedicated attribute overview with examples

ShowInInspectorAttribute class

Namespace: Sirenix.OdinInspector
Assembly: Sirenix.OdinInspector.Attributes
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter | AttributeTargets.All, AllowMultiple = false, Inherited = false)]
public class ShowInInspectorAttribute : Attribute, _Attribute

ShowInInspector is used on any member, and shows the value in the inspector. Note that the value being shown due to this attribute DOES NOT mean that the value is being serialized.

Inheritance
  • System.Object
  • System.Attribute
  • ShowInInspectorAttribute
Remarks

This can for example be combined with ReadOnlyAttribute to allow for live debugging of values.

note

Example

The following example shows how ShowInInspector is used to show properties in the inspector, that otherwise wouldn't.

public class MyComponent : MonoBehaviour
{
	[ShowInInspector]
	private int myField;

	[ShowInInspector]
	public int MyProperty { get; set; }
}

Constructors

ShowInInspectorAttribute()
public ShowInInspectorAttribute()