Sirenix.OdinInspector.Attributes AssetLists is used on lists and arrays and single elements of unity types, and replaces the default list drawer with a list of all possible assets with the specified filter. Use this to both filter and include or exclude assets from a list or an array, without navigating the project window. Asset lists works on all asset types such as materials, scriptable objects, prefabs, custom components, audio, textures etc, and does also show inherited types. The following example will display an asset list of all prefabs located in the project window. public class AssetListExamples : MonoBehaviour { [InfoBox("The AssetList attribute work on both lists of UnityEngine.Object types and UnityEngine.Object types, but have different behaviour.")] [AssetList] [InlineEditor(InlineEditorModes.LargePreview)] public GameObject Prefab; [AssetList] public List<PlaceableObject> PlaceableObjects; [AssetList(Path = "Plugins/Sirenix/")] [InlineEditor(InlineEditorModes.LargePreview)] public UnityEngine.Object Object; [AssetList(AutoPopulate = true)] public List<PlaceableObject> PlaceableObjectsAutoPopulated; [AssetList(LayerNames = "MyLayerName")] public GameObject[] AllPrefabsWithLayerName; [AssetList(AssetNamePrefix = "Rock")] public List<GameObject> PrefabsStartingWithRock; [AssetList(Path = "/Plugins/Sirenix/")] public List<GameObject> AllPrefabsLocatedInFolder; [AssetList(Tags = "MyTagA, MyTabB", Path = "/Plugins/Sirenix/")] public List<GameObject> GameObjectsWithTag; [AssetList(Path = "/Plugins/Sirenix/")] public List<Material> AllMaterialsInSirenix; [AssetList(Path = "/Plugins/Sirenix/")] public List<ScriptableObject> AllScriptableObjects; [InfoBox("Use a method as a custom filter for the asset list.")] [AssetList(CustomFilterMethod = "HasRigidbodyComponent")] public List<GameObject> MyRigidbodyPrefabs; private bool HasRigidbodyComponent(GameObject obj) { return obj.GetComponent<Rigidbody>() != null; } } If true, all assets found and displayed by the asset list, will automatically be added to the list when inspected. Comma separated list of tags to filter the asset list. Filter the asset list to only include assets with a specified layer. Filter the asset list to only include assets which name begins with. Filter the asset list to only include assets which is located at the specified path. Filter the asset list to only include assets for which the given filter method returns true. Initializes a new instance of the class. The AssetSelector attribute can be used on all Unity types and will prepend a small button next to the object field that when clicked, will present the user with a dropdown of assets to select from which can be customized from the attribute. True by default. True by default. If the ValueDropdown attribute is applied to a list, then disabling this, will render all child elements normally without using the ValueDropdown. The ValueDropdown will still show up when you click the add button on the list drawer, unless is true. False by default. If the ValueDropdown attribute is applied to a list, and is set to true, then enabling this, will exclude existing values, instead of rendering a checkbox indicating whether the item is already included or not. If the dropdown renders a tree-view, then setting this to true will ensure everything is expanded by default. By default, the dropdown will create a tree view. Gets or sets the width of the dropdown. Default is zero. Gets or sets the height of the dropdown. Default is zero. Gets or sets the title for the dropdown. Null by default. Specify which folders to search in. Specifying no folders will make it search in your entire project. Use the property for a more clean way of populating this array through attributes. The filters we should use when calling AssetDatabase.FindAssets. Specify which folders to search in. Specifying no folders will make it search in your entire project. You can decalir multiple paths using '|' as the seperator. Example: [AssetList(Paths = "Assets/Textures|Assets/Other/Textures")] This property is simply a more clean way of populating the array. AssetsOnly is used on object properties, and restricts the property to project assets, and not scene objects. Use this when you want to ensure an object is from the project, and not from the scene. The following example shows a component with a game object property, that must be a prefab from the project, and not a scene object. public MyComponent : MonoBehaviour { [AssetsOnly] public GameObject MyPrefab; } BoxGroup is used on any property and organizes the property in a boxed group. Use this to cleanly organize relevant values together in the inspector. The following example shows how BoxGroup is used to organize properties together into a box. public class BoxGroupExamples : MonoBehaviour { // Box with a centered title. [BoxGroup("Centered Title", centerLabel: true)] public int A; [BoxGroup("Centered Title", centerLabel: true)] public int B; [BoxGroup("Centered Title", centerLabel: true)] public int C; // Box with a title. [BoxGroup("Left Oriented Title")] public int D; [BoxGroup("Left Oriented Title")] public int E; // Box with a title recieved from a field. [BoxGroup("$DynamicTitle1"), LabelText("Dynamic Title")] public string DynamicTitle1 = "Dynamic box title"; [BoxGroup("$DynamicTitle1")] public int F; // Box with a title recieved from a property. [BoxGroup("$DynamicTitle2")] public int G; [BoxGroup("$DynamicTitle2")] public int H; // Box without a title. [InfoBox("You can also hide the label of a box group.")] [BoxGroup("NoTitle", false)] public int I; [BoxGroup("NoTitle")] public int J; [BoxGroup("NoTitle")] public int K; #if UNITY_EDITOR public string DynamicTitle2 { get { return UnityEditor.PlayerSettings.productName; } } #endif [BoxGroup("Boxed Struct"), HideLabel] public SomeStruct BoxedStruct; public SomeStruct DefaultStruct; [Serializable] public struct SomeStruct { public int One; public int Two; public int Three; } } If true a label for the group will be drawn on top. If true the header label will be places in the center of the group header. Otherwise it will be in left side. If non-null, this is used instead of the group's name as the title label. Adds the property to the specified box group. The box group. If true a label will be drawn for the group. If set to true the header label will be centered. The order of the group in the inspector. Initializes a new instance of the class. Use the other constructor overloads in order to show a header-label on the box group. Combines the box group with another group. The other group. Buttons are used on functions, and allows for clickable buttons in the inspector. The following example shows a component that has an initialize method, that can be called from the inspector. public class MyComponent : MonoBehaviour { [Button] private void Init() { // ... } } The following example show how a Button could be used to test a function. public class MyBot : MonoBehaviour { [Button] private void Jump() { // ... } } The following example show how a Button can named differently than the function it's been attached to. public class MyComponent : MonoBehaviour { [Button("Function")] private void MyFunction() { // ... } } Gets the height of the button. If it's zero or below then use default. Use this to override the label on the button. The style in which to draw the button. If the button contains parameters, you can disable the foldout it creates by setting this to true. Whether to display the button method's parameters (if any) as values in the inspector. True by default. If this is set to false, the button method will instead be invoked through an ActionResolver or ValueResolver (based on whether it returns a value), giving access to contextual named parameter values like "InspectorProperty property" that can be passed to the button method. Whether the containing object or scene (if there is one) should be marked dirty when the button is clicked. True by default. If the button has a return type, set this to false to not draw the result. Default value is true. Creates a button in the inspector named after the method. Creates a button in the inspector named after the method. The size of the button. Creates a button in the inspector named after the method. The size of the button. Creates a button in the inspector with a custom name. Custom name for the button. Creates a button in the inspector with a custom name. Custom name for the button. Size of the button. Creates a button in the inspector with a custom name. Custom name for the button. Size of the button in pixels. Creates a button in the inspector named after the method. Button style for methods with parameters. Creates a button in the inspector named after the method. The size of the button. Button style for methods with parameters. Creates a button in the inspector named after the method. The size of the button. Button style for methods with parameters. Creates a button in the inspector with a custom name. Custom name for the button. Button style for methods with parameters. Creates a button in the inspector with a custom name. Custom name for the button. Size of the button. Button style for methods with parameters. Creates a button in the inspector with a custom name. Custom name for the button. Size of the button in pixels. Button style for methods with parameters. ButtonGroup is used on any instance function, and adds buttons to the inspector organized into horizontal groups. Use this to organize multiple button in a tidy horizontal group. The following example shows how ButtonGroup is used to organize two buttons into one group. public class MyComponent : MonoBehaviour { [ButtonGroup("MyGroup")] private void A() { // .. } [ButtonGroup("MyGroup")] private void B() { // .. } } The following example shows how ButtonGroup can be used to create multiple groups of buttons. public class MyComponent : MonoBehaviour { [ButtonGroup("First")] private void A() { } [ButtonGroup("First")] private void B() { } [ButtonGroup("")] private void One() { } [ButtonGroup("")] private void Two() { } [ButtonGroup("")] private void Three() { } } Organizes the button into the specified button group. The group to organize the button into. The order of the group in the inspector.. Button style for methods with parameters. Draws a foldout box around the parameters of the method with the button on the box header itself. This is the default style of a method with parameters. Draws a button with a foldout to expose the parameters of the method. Draws a foldout box around the parameters of the method with the button at the bottom of the box. The ChildGameObjectsOnly attribute can be used on Components and GameObject fields and will prepend a small button next to the object-field that will search through all child gameobjects for assignable objects and present them in a dropdown for the user to choose from. Instead of making a new attribute, and a new drawer, for a one-time thing, you can with this attribute, make a method that acts as a custom property drawer. These drawers will out of the box have support for undo/redo and multi-selection. Usage: public class CustomDrawerExamples : MonoBehaviour { public float From = 2, To = 7; [CustomValueDrawer("MyStaticCustomDrawerStatic")] public float CustomDrawerStatic; [CustomValueDrawer("MyStaticCustomDrawerInstance")] public float CustomDrawerInstance; [CustomValueDrawer("MyStaticCustomDrawerArray")] public float[] CustomDrawerArray; #if UNITY_EDITOR private static float MyStaticCustomDrawerStatic(float value, GUIContent label) { return EditorGUILayout.Slider(value, 0f, 10f); } private float MyStaticCustomDrawerInstance(float value, GUIContent label) { return EditorGUILayout.Slider(value, this.From, this.To); } private float MyStaticCustomDrawerArray(float value, GUIContent label) { return EditorGUILayout.Slider(value, this.From, this.To); } #endif } Name of the custom drawer method. Obsolete; use the Action member instead. A resolved string that defines the custom drawer action to take, such as an expression or method invocation. Instead of making a new attribute, and a new drawer, for a one-time thing, you can with this attribute, make a method that acts as a custom property drawer. These drawers will out of the box have support for undo/redo and multi-selection. A resolved string that defines the custom drawer action to take, such as an expression or method invocation. Disables a property if it is drawn within an . Disables a property if it is drawn from a non-prefab asset or instance. Disables a property if it is drawn from a prefab asset. Disables a property if it is drawn from a prefab instance. Disables a property if it is drawn from a prefab asset or a prefab instance. Indicates that the member should not be drawn as a value reference, if it becomes a reference to another value in the tree. Beware, and use with care! This may lead to infinite draw loops! Tells the validation system that this member should not be validated. It will not show validation messages in the inspector, and it will not be scanned by the project validator. An attribute that enables GUI. public class InlineEditorExamples : MonoBehaviour { [EnableGUI] public string SomeReadonlyProperty { get { return "My GUI is usually disabled." } } } Draws an enum selector in the inspector with next and previous buttons to let you cycle through the available values for the enum property. public enum MyEnum { One, Two, Three, } public class MyMonoBehaviour : MonoBehaviour { [EnumPaging] public MyEnum Value; } FilePath is used on string properties, and provides an interface for file paths. The following example demonstrates how FilePath is used. public class FilePathExamples : MonoBehaviour { // By default, FilePath provides a path relative to the Unity project. [FilePath] public string UnityProjectPath; // It is possible to provide custom parent path. Parent paths can be relative to the Unity project, or absolute. [FilePath(ParentFolder = "Assets/Plugins/Sirenix")] public string RelativeToParentPath; // Using parent path, FilePath can also provide a path relative to a resources folder. [FilePath(ParentFolder = "Assets/Resources")] public string ResourcePath; // Provide a comma seperated list of allowed extensions. Dots are optional. [FilePath(Extensions = "cs")] public string ScriptFiles; // By setting AbsolutePath to true, the FilePath will provide an absolute path instead. [FilePath(AbsolutePath = true)] [BoxGroup("Conditions")] public string AbsolutePath; // FilePath can also be configured to show an error, if the provided path is invalid. [FilePath(RequireValidPath = true)] public string ValidPath; // By default, FilePath will enforce the use of forward slashes. It can also be configured to use backslashes instead. [FilePath(UseBackslashes = true)] public string Backslashes; // FilePath also supports member references with the $ symbol. [FilePath(ParentFolder = "$DynamicParent", Extensions = "$DynamicExtensions")] public string DynamicFilePath; public string DynamicParent = "Assets/Plugin/Sirenix"; public string DynamicExtensions = "cs, unity, jpg"; } If true the FilePath will provide an absolute path, instead of a relative one. Comma separated list of allowed file extensions. Dots are optional. Supports member referencing with $. ParentFolder provides an override for where the path is relative to. ParentFolder can be relative to the Unity project, or an absolute path. Supports member referencing with $. If true an error will be displayed for invalid, or missing paths. If true an error will be displayed for non-existing paths. By default FilePath enforces forward slashes. Set UseBackslashes to true if you want backslashes instead. Gets or sets a value indicating whether the path should be read only. FolderPath is used on string properties, and provides an interface for directory paths. The following example demonstrates how FolderPath is used. public class FolderPathExamples : MonoBehaviour { // By default, FolderPath provides a path relative to the Unity project. [FolderPath] public string UnityProjectPath; // It is possible to provide custom parent patn. ParentFolder paths can be relative to the Unity project, or absolute. [FolderPath(ParentFolder = "Assets/Plugins/Sirenix")] public string RelativeToParentPath; // Using ParentFolder, FolderPath can also provide a path relative to a resources folder. [FolderPath(ParentFolder = "Assets/Resources")] public string ResourcePath; // By setting AbsolutePath to true, the FolderPath will provide an absolute path instead. [FolderPath(AbsolutePath = true)] public string AbsolutePath; // FolderPath can also be configured to show an error, if the provided path is invalid. [FolderPath(RequireValidPath = true)] public string ValidPath; // By default, FolderPath will enforce the use of forward slashes. It can also be configured to use backslashes instead. [FolderPath(UseBackslashes = true)] public string Backslashes; // FolderPath also supports member references with the $ symbol. [FolderPath(ParentFolder = "$DynamicParent")] public string DynamicFolderPath; public string DynamicParent = "Assets/Plugins/Sirenix"; } If true the FolderPath will provide an absolute path, instead of a relative one. ParentFolder provides an override for where the path is relative to. ParentFolder can be relative to the Unity project, or an absolute path. Supports member referencing with $. If true an error will be displayed for invalid, or missing paths. If true an error will be displayed for non-existing paths. By default FolderPath enforces forward slashes. Set UseBackslashes to true if you want backslashes instead. Indicates that Odin should hide the reference box, if this property would otherwise be drawn as a reference to another property, due to duplicate reference values being encountered. Note that if the value is referencing itself recursively, then the reference box will be drawn regardless of this attribute in all recursive draw calls.

HideIfGroup allows for showing or hiding a group of properties based on a condition.

The attribute is a group attribute and can therefore be combined with other group attributes, and even be used to show or hide entire groups.

Note that in the vast majority of cases where you simply want to be able to control the visibility of a single group, it is better to use the VisibleIf parameter that *all* group attributes have.

Whether or not to visually animate group visibility changes. The optional member value. Name of member to use when to hide the group. Defaults to the name of the group, by can be overriden by setting this property. A resolved string that defines the condition to check the value of, such as a member name or an expression. Makes a group that can be shown or hidden based on a condition. The group path. If true then a fade animation will be played when the group is hidden or shown. Makes a group that can be shown or hidden based on a condition. The group path. The value the member should equal for the property to shown. If true then a fade animation will be played when the group is hidden or shown. Combines HideIfGroup attributes. Another ShowIfGroup attribute. Hides a property if it is drawn within an . Hides a property if it is drawn from a non prefab instance or asset. Hides a property if it is drawn from a prefab asset. Hides a property if it is drawn from a prefab instance. Hides a property if it is drawn from a prefab instance or a prefab asset. The HideInTables attribute is used to prevent members from showing up as columns in tables drawn using the . Apply HideNetworkBehaviourFields to your class to prevent the special "Network Channel" and "Network Send Interval" properties from being shown in the inspector for a NetworkBehaviour. This attribute has no effect on classes that are not derived from NetworkBehaviour. The following example shows how to use this attribute. [HideNetworkBehaviourFields] public class MyComponent : NetworkBehaviour { // The "Network Channel" and "Network Send Interval" properties will not be shown for this component in the inspector } The Inline Property is used to place the contents of a type next to the label, instead of being rendered in a foldout. public class InlinePropertyExamples : MonoBehaviour { public Vector3 Vector3; public Vector3Int Vector3Int; [InlineProperty(LabelWidth = 12)] // It can be placed on classes as well as members public Vector2Int Vector2Int; } [Serializable] [InlineProperty(LabelWidth = 12)] // It can be placed on classes as well as members public struct Vector3Int { [HorizontalGroup] public int X; [HorizontalGroup] public int Y; [HorizontalGroup] public int Z; } [Serializable] public struct Vector2Int { [HorizontalGroup] public int X; [HorizontalGroup] public int Y; } Specify a label width for all child properties. LabelWidth is used to change the width of labels for properties. The following example shows how LabelText is applied to a few property fields. public MyComponent : MonoBehaviour { [LabelWidth("3")] public int MyInt3; } The new text of the label. Give a property a custom label. The width of the label. OnCollectionChanged can be put on collections, and provides an event callback when the collection is about to be changed through the inspector, and when the collection has been changed through the inspector. Additionally, it provides a CollectionChangeInfo struct containing information about the exact changes made to the collection. This attribute works for all collections with a collection resolver, amongst them arrays, lists, dictionaries, hashsets, stacks and linked lists. Note that this attribute only works in the editor! Collections changed by script will not trigger change events! The following example shows how OnCollectionChanged can be used to get callbacks when a collection is being changed. [OnCollectionChanged("Before", "After")] public List<string> list; public void Before(CollectionChangeInfo info) { if (info.ChangeType == CollectionChangeType.Add || info.ChangeType == CollectionChangeType.Insert) { Debug.Log("Adding to the list!"); } else if (info.ChangeType == CollectionChangeType.RemoveIndex || info.ChangeType == CollectionChangeType.RemoveValue) { Debug.Log("Removing from the list!"); } } public void After(CollectionChangeInfo info) { if (info.ChangeType == CollectionChangeType.Add || info.ChangeType == CollectionChangeType.Insert) { Debug.Log("Finished adding to the list!"); } else if (info.ChangeType == CollectionChangeType.RemoveIndex || info.ChangeType == CollectionChangeType.RemoveValue) { Debug.Log("Finished removing from the list!"); } } The OnInspectorDispose attribute takes in an action string as an argument (typically the name of a method to be invoked, or an expression to be executed), and executes that action when the property's drawers are disposed in the inspector. Disposing will happen at least once, when the inspector changes selection or the property tree is collected by the garbage collector, but may also happen several times before that, most often when the type of a polymorphic property changes and it refreshes its drawer setup and recreates all its children, disposing of the old setup and children. The following example demonstrates how OnInspectorDispose works. public class MyComponent : MonoBehaviour { [OnInspectorDispose(@"@UnityEngine.Debug.Log(""Dispose event invoked!"")")] [ShowInInspector, InfoBox("When you change the type of this field, or set it to null, the former property setup is disposed. The property setup will also be disposed when you deselect this example."), DisplayAsString] public BaseClass PolymorphicField; public abstract class BaseClass { public override string ToString() { return this.GetType().Name; } } public class A : BaseClass { } public class B : BaseClass { } public class C : BaseClass { } } This constructor should be used when the attribute is placed directly on a method. This constructor should be used when the attribute is placed on a non-method member. The OnInspectorInit attribute takes in an action string as an argument (typically the name of a method to be invoked, or an expression to be executed), and executes that action when the property's drawers are initialized in the inspector. Initialization will happen at least once during the first drawn frame of any given property, but may also happen several times later, most often when the type of a polymorphic property changes and it refreshes its drawer setup and recreates all its children. The following example demonstrates how OnInspectorInit works. public class MyComponent : MonoBehaviour { // Display current time for reference. [ShowInInspector, DisplayAsString, PropertyOrder(-1)] public string CurrentTime { get { GUIHelper.RequestRepaint(); return DateTime.Now.ToString(); } } // OnInspectorInit executes the first time this string is about to be drawn in the inspector. // It will execute again when the example is reselected. [OnInspectorInit("@TimeWhenExampleWasOpened = DateTime.Now.ToString()")] public string TimeWhenExampleWasOpened; // OnInspectorInit will not execute before the property is actually "resolved" in the inspector. // Remember, Odin's property system is lazily evaluated, and so a property does not actually exist // and is not initialized before something is actually asking for it. // // Therefore, this OnInspectorInit attribute won't execute until the foldout is expanded. [FoldoutGroup("Delayed Initialization", Expanded = false, HideWhenChildrenAreInvisible = false)] [OnInspectorInit("@TimeFoldoutWasOpened = DateTime.Now.ToString()")] public string TimeFoldoutWasOpened; } This constructor should be used when the attribute is placed directly on a method. This constructor should be used when the attribute is placed on a non-method member. OnStateUpdate provides an event callback when the property's state should be updated, when the StateUpdaters run on the property instance. This generally happens at least once per frame, and the callback will be invoked even when the property is not visible. This can be used to approximate custom StateUpdaters like [ShowIf] without needing to make entire attributes and StateUpdaters for one-off cases. The following example shows how OnStateUpdate can be used to control the visible state of a property. public class MyComponent : MonoBehaviour { [OnStateUpdate("@$property.State.Visible = ToggleMyInt")] public int MyInt; public bool ToggleMyInt; } The following example shows how OnStateUpdate can be used to control the expanded state of a list. public class MyComponent : MonoBehaviour { [OnStateUpdate("@$property.State.Expanded = ExpandList")] public List<string> list; public bool ExpandList; } The following example shows how OnStateUpdate can be used to control the state of another property. public class MyComponent : MonoBehaviour { public List>string< list; [OnStateUpdate("@#(list).State.Expanded = $value")] public bool ExpandList; } Draws a square ObjectField which renders a preview for UnityEngine.Object types. This object field also adds support for drag and drop, dragging an object to another square object field, swaps the values. If you hold down control while letting go it will replace the value, And you can control + click the object field to quickly delete the value it holds. These object fields can also be selectively enabled and customized globally from the Odin preferences window. The following example shows how PreviewField is applied to a few property fields. public MyComponent : MonoBehaviour { [PreviewField] public UnityEngine.Object SomeObject; [PreviewField] public Texture SomeTexture; [HorizontalGroup, HideLabel, PreviewField(30)] public Material A, B, C, D, F; } The height of the object field Left aligned. Whether an alignment value is specified. Draws a square object field which renders a preview for UnityEngine.Object type objects. Draws a square object field which renders a preview for UnityEngine.Object type objects. The height of the preview field. Draws a square object field which renders a preview for UnityEngine.Object type objects. The height of the preview field. The alignment of the preview field. Draws a square object field which renders a preview for UnityEngine.Object type objects. The alignment of the preview field. Draws a horizontal progress bar based on the value of the property. Use it for displaying a meter to indicate how full an inventory is, or to make a visual indication of a health bar. The following example shows how ProgressBar can be used. public class ProgressBarExample : MonoBehaviour { // Default progress bar. [ProgressBar(0, 100)] public int ProgressBar; // Health bar. [ProgressBar(0, 100, ColorMember = "GetHealthBarColor")] public float HealthBar = 50; private Color GetHealthBarColor(float value) { // Blends between red, and yellow color for when the health is below 30, // and blends between yellow and green color for when the health is above 30. return Color.Lerp(Color.Lerp( Color.red, Color.yellow, MathUtilities.LinearStep(0f, 30f, value)), Color.green, MathUtilities.LinearStep(0f, 100f, value)); } // Stacked health bar. // The ProgressBar attribute is placed on property, without a set method, so it can't be edited directly. // So instead we have this Range attribute on a float to change the value. [Range(0, 300)] public float StackedHealth; [ProgressBar(0, 100, ColorMember = "GetStackedHealthColor", BackgroundColorMember = "GetStackHealthBackgroundColor")] private float StackedHealthProgressBar { // Loops the stacked health value between 0, and 100. get { return this.StackedHealth - 100 * (int)((this.StackedHealth - 1) / 100); } } private Color GetStackedHealthColor() { return this.StackedHealth > 200 ? Color.cyan : this.StackedHealth > 100 ? Color.green : Color.red; } private Color GetStackHealthBackgroundColor() { return this.StackedHealth > 200 ? Color.green : this.StackedHealth > 100 ? Color.red : new Color(0.16f, 0.16f, 0.16f, 1f); } // Custom color and height. [ProgressBar(-100, 100, r: 1, g: 1, b: 1, Height = 30)] public short BigProgressBar = 50; // You can also reference members by name to dynamically assign the min and max progress bar values. [ProgressBar("DynamicMin", "DynamicMax")] public float DynamicProgressBar; public float DynamicMin, DynamicMax; } The minimum value. The maximum value. The name of a field, property or method to get the min values from. Obsolete; use the MinGetter member instead. A resolved string that should evaluate to a float value, and will be used as the min bounds. The name of a field, property or method to get the max values from. Obsolete; use the MaxGetter member instead. A resolved string that should evaluate to a float value, and will be used as the max bounds. The red channel of the color of the progress bar. The green channel of the color of the progress bar. The blue channel of the color of the progress bar. The height of the progress bar in pixels. Defaults to 12 pixels. Optional reference to a Color field, property or method, to dynamically change the color of the progress bar. Obsolete; use the ColorGetter member instead. Optional resolved string that should evaluate to a Color value, to dynamically change the color of the progress bar. Optional reference to a Color field, property or method, to dynamically change the background color of the progress bar. Default background color is (0.16, 0.16, 0.16, 1). Obsolete; use the BackgroundColorGetter member instead. Optional resolved string that should evaluate to a Color value, to dynamically change the background color of the progress bar. Default background color is (0.16, 0.16, 0.16, 1). If true then the progress bar will be drawn in tiles. References a member by name to get a custom value label string from. Obsolete; use the CustomValueStringGetter member instead. A resolved string to get a custom value label string from. Draws a progress bar for the value. The minimum value. The maximum value. The red channel of the color of the progress bar. The green channel of the color of the progress bar. The blue channel of the color of the progress bar. Draws a progress bar for the value. A resolved string that should evaluate to a float value, and will be used as the min bounds. The maximum value. The red channel of the color of the progress bar. The green channel of the color of the progress bar. The blue channel of the color of the progress bar. Draws a progress bar for the value. The minimum value. A resolved string that should evaluate to a float value, and will be used as the max bounds. The red channel of the color of the progress bar. The green channel of the color of the progress bar. The blue channel of the color of the progress bar. Draws a progress bar for the value. A resolved string that should evaluate to a float value, and will be used as the min bounds. A resolved string that should evaluate to a float value, and will be used as the max bounds. The red channel of the color of the progress bar. The green channel of the color of the progress bar. The blue channel of the color of the progress bar. If true then there will be drawn a value label on top of the progress bar. Gets a value indicating if the user has set a custom DrawValueLabel value. The alignment of the value label on top of the progress bar. Defaults to center. Gets a value indicating if the user has set a custom ValueLabelAlignment value. PropertyRange attribute creates a slider control to set the value of a property to between the specified range. This is equivalent to Unity's Range attribute, but this attribute can be applied to both fields and property. The following example demonstrates how PropertyRange is used. public class MyComponent : MonoBehaviour { [PropertyRange(0, 100)] public int MyInt; [PropertyRange(-100, 100)] public float MyFloat; [PropertyRange(-100, -50)] public decimal MyDouble; // This attribute also supports dynamically referencing members by name to assign the min and max values for the range field. [PropertyRange("DynamicMin", "DynamicMax"] public float MyDynamicValue; public float DynamicMin, DynamicMax; } The minimum value. The maximum value. The name of a field, property or method to get the min value from. Obsolete; use the MinGetter member instead. A resolved string that should evaluate to a float value, and will be used as the min bounds. The name of a field, property or method to get the max value from. Obsolete; use the MaxGetter member instead. A resolved string that should evaluate to a float value, and will be used as the max bounds. Creates a slider control to set the value of the property to between the specified range.. The minimum value. The maximum value. Creates a slider control to set the value of the property to between the specified range.. A resolved string that should evaluate to a float value, and will be used as the min bounds. The maximum value. Creates a slider control to set the value of the property to between the specified range.. The minimum value. A resolved string that should evaluate to a float value, and will be used as the max bounds. Creates a slider control to set the value of the property to between the specified range.. A resolved string that should evaluate to a float value, and will be used as the min bounds. A resolved string that should evaluate to a float value, and will be used as the max bounds. The PropertySpace attribute have the same function as Unity's existing Space attribute, but can be applied anywhere as opposed to just fields. The following example demonstrates the usage of the PropertySpace attribute. [PropertySpace] // Defaults to a space of 8 pixels just like Unity's Space attribute. public int MyField; [ShowInInspector, PropertySpace(16)] public int MyProperty { get; set; } [ShowInInspector, PropertySpace(16, 16)] public int MyProperty { get; set; } [Button, PropertySpace(32)] public void MyMethod() { ... } [PropertySpace(-8)] // A negative space can also be remove existing space between properties. public int MovedUp; The space between properties in pixels. The space between properties in pixels. Adds a space of 8 pixels between properties. Adds a space between properties. Adds a space between properties. Groups buttons into a group that will position and resize the buttons based on the amount of available layout space. [ResponsiveButtonGroup] public void Foo() { } [ResponsiveButtonGroup] public void Bar() { } [ResponsiveButtonGroup] public void Baz() { } [ResponsiveButtonGroup(UniformLayout = true)] public void Foo() { } [ResponsiveButtonGroup] public void Bar() { } [ResponsiveButtonGroup] public void Baz() { } [ResponsiveButtonGroupAttribute(UniformLayout = true, DefaultButtonSize = ButtonSizes.Large)] public void Foo() { } [GUIColor(0, 1, 0))] [Button(ButtonSizes.Large)] [ResponsiveButtonGroup] public void Bar() { } [ResponsiveButtonGroup] public void Baz() { } [TabGroup("SomeTabGroup", "SomeTab")] [ResponsiveButtonGroup("SomeTabGroup/SomeTab/SomeBtnGroup")] public void Foo() { } [ResponsiveButtonGroup("SomeTabGroup/SomeTab/SomeBtnGroup")] public void Bar() { } [ResponsiveButtonGroup("SomeTabGroup/SomeTab/SomeBtnGroup")] public void Baz() { } The default size of the button. If true then the widths of a line of buttons will be the same. Draws a button that will be placed in a group that will respond to the horizontal space available to the group. The name of the group to place the button in. Merges the values of this group with another ResponsiveButtonGroupAttribute. The attribute to combine with.

ShowIfGroup allows for showing or hiding a group of properties based on a condition.

The attribute is a group attribute and can therefore be combined with other group attributes, and even be used to show or hide entire groups.

Note that in the vast majority of cases where you simply want to be able to control the visibility of a single group, it is better to use the VisibleIf parameter that *all* group attributes have.

Whether or not to visually animate group visibility changes. Alias for AnimateVisibility. The optional member value. Name of member to use when to hide the group. Defaults to the name of the group, by can be overriden by setting this property. A resolved string that defines the condition to check the value of, such as a member name or an expression. Makes a group that can be shown or hidden based on a condition. The group path. If true then a fade animation will be played when the group is hidden or shown. Makes a group that can be shown or hidden based on a condition. The group path. The value the member should equal for the property to shown. If true then a fade animation will be played when the group is hidden or shown. Combines ShowIfGroup attributes. Another ShowIfGroup attribute. Only shows a property if it is drawn within an . ShowPropertyResolver shows the property resolver responsible for bringing the member into the property tree. This is useful in situations where you want to debug why a particular member that is normally not shown in the inspector suddenly is. public class MyComponent : MonoBehaviour { [ShowPropertyResolver] public int IndentedInt; } The SuffixLabel attribute draws a label at the end of a property. Use this for conveying intend about a property. Is the distance measured in meters, kilometers, or in light years?. Is the angle measured in degrees or radians? Using SuffixLabel, you can place a neat label at the end of a property, to clearly show how the the property is used. The following example demonstrates how SuffixLabel is used. public class MyComponent : MonoBehaviour { // The SuffixLabel attribute draws a label at the end of a property. // It's useful for conveying intend about a property. // Fx, this field is supposed to have a prefab assigned. [SuffixLabel("Prefab")] public GameObject GameObject; // Using the Overlay property, the suffix label will be drawn on top of the property instead of behind it. // Use this for a neat inline look. [SuffixLabel("ms", Overlay = true)] public float Speed; [SuffixLabel("radians", Overlay = true)] public float Angle; // The SuffixLabel attribute also supports string member references by using $. [SuffixLabel("$Suffix", Overlay = true)] public string Suffix = "Dynamic suffix label"; } The label displayed at the end of the property. If true the suffix label will be drawn on top of the property, instead of after. Draws a label at the end of the property. The text of the label. If true the suffix label will be drawn on top of the property, instead of after. The TableColumnWidth attribute is used to further customize the width of a column in tables drawn using the . [TableList] public List<SomeType> TableList = new List<SomeType>(); [Serializable] public class SomeType { [LabelWidth(30)] [TableColumnWidth(130, false)] [VerticalGroup("Combined")] public string A; [LabelWidth(30)] [VerticalGroup("Combined")] public string B; [Multiline(2), Space(3)] public string fields; } The width of the column. Whether the column should be resizable. True by default. Initializes a new instance of the class. The width of the column in pixels. If true then the column can be resized in the inspector. Renders lists and arrays in the inspector as tables. If ShowPaging is enabled, this will override the default setting specified in the Odin Preferences window. Mark the table as read-only. This removes all editing capabilities from the list such as Add and delete, but without disabling GUI for each element drawn as otherwise would be the case if the was used. The default minimum column width - 40 by default. This can be overwriten by individual columns using the . If true, a label is drawn for each element which shows the index of the element. Whether to draw all rows in a scroll-view. The number of pixels before a scroll view appears. 350 by default. The number of pixels before a scroll view appears. 0 by default. If true, expanding and collapsing the table from the table title-bar is no longer an option. Whether to hide the toolbar containing the add button and pagin etc.s The cell padding. Whether paging buttons should be added to the title bar. The default value of this, can be customized from the Odin Preferences window. Whether the ShowPaging property has been set. Sets the Min and Max ScrollViewHeight. The TableMatrix attribute is used to further specify how Odin should draw two-dimensional arrays. // Inheriting from SerializedMonoBehaviour is only needed if you want Odin to serialize the multi-dimensional arrays for you. // If you prefer doing that yourself, you can still make Odin show them in the inspector using the ShowInInspector attribute. public class TableMatrixExamples : SerializedMonoBehaviour { [InfoBox("Right-click and drag column and row labels in order to modify the tables."), PropertyOrder(-10), OnInspectorGUI] private void ShowMessageAtOP() { } [BoxGroup("Two Dimensional array without the TableMatrix attribute.")] public bool[,] BooleanTable = new bool[15, 6]; [BoxGroup("ReadOnly table")] [TableMatrix(IsReadOnly = true)] public int[,] ReadOnlyTable = new int[5, 5]; [BoxGroup("Labled table")] [TableMatrix(HorizontalTitle = "X axis", VerticalTitle = "Y axis")] public GameObject[,] LabledTable = new GameObject[15, 10]; [BoxGroup("Enum table")] [TableMatrix(HorizontalTitle = "X axis")] public InfoMessageType[,] EnumTable = new InfoMessageType[4,4]; [BoxGroup("Custom table")] [TableMatrix(DrawElementMethod = "DrawColoredEnumElement", ResizableColumns = false)] public bool[,] CustomCellDrawing = new bool[30,30]; #if UNITY_EDITOR private static bool DrawColoredEnumElement(Rect rect, bool value) { if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition)) { value = !value; GUI.changed = true; Event.current.Use(); } UnityEditor.EditorGUI.DrawRect(rect.Padding(1), value ? new Color(0.1f, 0.8f, 0.2f) : new Color(0, 0, 0, 0.5f)); return value; } #endif } If true, inserting, removing and dragging columns and rows will become unavailable. But the cells themselves will remain modifiable. If you want to disable everything, you can use the attribute. Whether or not columns are resizable. The vertical title label. The horizontal title label. Override how Odin draws each cell. [TableMatrix(DrawElementMethod='DrawMyElement')] public MyType[,] myArray; private static MyType DrawElement(Rect rect, MyType value) { return GUI.DrawMyType(rect, value); } The height for all rows. 0 = default row height. If true, the height of each row will be the same as the width of the first cell. If true, no column indices drawn. If true, no row indices drawn. Whether the drawn table should respect the current GUI indent level. If true, tables are drawn with rows/columns reversed (C# initialization order). Name of any field, property or method member that implements IList. E.g. arrays or Lists. Obsolete; use the FilterGetter member instead. A resolved string that should evaluate to a value that is assignable to IList; e.g, arrays and lists are compatible. Gets or sets the title for the dropdown. Null by default. If true, the value will be drawn normally after the type selector dropdown has been drawn. False by default. Creates a dropdown menu for a property. A resolved string that should evaluate to a value that is assignable to IList; e.g, arrays and lists are compatible. The TypeInfoBox attribute adds an info box to the very top of a type in the inspector. Use this to add an info box to the top of a class in the inspector, without having to use neither the PropertyOrder nor the OnInspectorGUI attribute. The following example demonstrates the use of the TypeInfoBox attribute. [TypeInfoBox("This is my component and it is mine.")] public class MyComponent : MonoBehaviour { // Class implementation. } The message to display in the info box. Draws an info box at the top of a type in the inspector. The message to display in the info box. VerticalGroup is used to gather properties together in a vertical group in the inspector. This doesn't do much in and of itself, but in combination with other groups, such as it can be very useful. The following example demonstrates how VerticalGroup can be used in conjunction with public class MyComponent : MonoBehaviour { [HorizontalGroup("Split")] [VerticalGroup("Split/Left")] public Vector3 Vector; [VerticalGroup("Split/Left")] public GameObject First; [VerticalGroup("Split/Left")] public GameObject Second; [VerticalGroup("Split/Right", PaddingTop = 18f)] public int A; [VerticalGroup("Split/Right")] public int B; } Space in pixels at the top of the group. Space in pixels at the bottom of the group. Groups properties vertically. The group ID. The group order. Groups properties vertically. GroupId: _DefaultVerticalGroup The group order. Combines properties that have been group vertically. The group attribute to combine with. Not yet documented. Not yet documented. Adds a search filter that can search the children of the field or type on which it is applied. Note that this does not currently work when directly applied to dictionaries, though a search field "above" the dictionary will still search the dictionary's properties if it is searching recursively. Whether to use fuzzy string matching for the search. Default value: true. The options for which things to use to filter the search. Default value: All. Whether to search recursively, or only search the top level properties. Default value: true. When this attribute is added is added to another attribute, then attributes from that attribute will also be added to the property in the attribute processing step. How the InlineEditor attribute drawer should draw the object field. Draws the object field in a box. Draws the object field with a foldout. Hides the object field unless it's null. Hidden the object field also when the object is null. Implement this interface to create custom matching logic for search filtering in the inspector. The following example shows how you might do this: public class MyCustomClass : ISearchFilterable { public bool SearchEnabled; public string MyStr; public bool IsMatch(string searchString) { if (SearchEnabled) { return MyStr.Contains(searchString); } return false; } } How the square object field should be aligned. Left aligned. Aligned to the center. Right aligned. Options for filtering search. Title alignment enum used by various attributes. Title and subtitle left aligned. Title and subtitle centered aligned. Title and subtitle right aligned. Title on the left, subtitle on the right. Groups properties vertically together with a title, an optional subtitle, and an optional horizontal line. Optional subtitle. Title alignment. Gets a value indicating whether or not to draw a horizontal line below the title. If true the title will be displayed with a bold font. Gets a value indicating whether or not to indent all group members. Groups properties vertically together with a title, an optional subtitle, and an optional horizontal line. The title- Optional subtitle. The text alignment. Horizontal line. Bold text. Whether or not to indent all group members. The group order. Combines TitleGroup attributes. The other group attribute to combine with. Various built-in button sizes. Small button size, fits well with properties in the inspector. A larger button. A very large button. A gigantic button. Twice as big as Large ColorPalette is used on any Color property, and allows for choosing colors from different definable palettes. Use this to allow the user to choose from a set of predefined color options. See and edit the color palettes in Tools > Odin Inspector > Drawers > Color Palettes. The color property is not tied to the color palette, and can be edited. Therefore the color will also not update if the ColorPalette is edited. The following example shows how ColorPalette is applied to a property. The user can freely choose between all available ColorPalettes. public class ColorPaletteExamples : MonoBehaviour { [ColorPalette] public Color ColorOptions; [ColorPalette("Underwater")] public Color UnderwaterColor; [ColorPalette("Fall"), HideLabel] public Color WideColorPalette; [ColorPalette("My Palette")] public Color MyColor; [ColorPalette("Clovers")] public Color[] ColorArray; } Gets the name of the palette. Indicates if the color palette should show alpha values or not. Adds a color palette options to a Color property. Adds color options to a Color property from a specific palette. Name of the palette. CustomContextMenu is used on any property, and adds a custom options to the context menu for the property. Use this for when you want to add custom actions to the context menu of a property. CustomContextMenu currently does not support static functions. The following example shows how CustomContextMenu is used to add a custom option to a property. public class MyComponent : MonoBehaviour { [CustomContextMenu("My custom option", "MyAction")] public Vector3 MyVector; private void MyAction() { MyVector = Random.onUnitSphere; } } The name of the menu item. The name of the callback method. Obsolete; use the Action member instead. A resolved string defining the action to take when the context menu is clicked. Adds a custom option to the context menu of the property. The name of the menu item. A resolved string defining the action to take when the context menu is clicked. Delays applying changes to properties while they still being edited in the inspector. Similar to Unity's built-in Delayed attribute, but this attribute can also be applied to properties. DetailedInfoBox is used on any property, and displays a message box that can be expanded to show more details. Use this to convey a message to a user, and give them the option to see more details. The following example shows how DetailedInfoBox is used on a field. public class MyComponent : MonoBehaviour { [DetailedInfoBox("This is a message", "Here is some more details about that message")] public int MyInt; } The message for the message box. The hideable details of the message box. Type of the message box. Optional name of a member to hide or show the message box. Displays a message box with hideable details. The message for the message box. The hideable details of the message box. Type of the message box. Optional name of a member to hide or show the message box. Various display modes for the dictionary to draw its items. Draws all dictionary items in two columns. The left column contains all key values, the right column displays all values. Draws each dictionary item in a box with the key in the header and the value inside the box. Whether or not the box is expanded or collapsed by default, is determined by the "Expand Foldout By Default" setting found in the preferences window "Tools > Odin Inspector > Preferences > Drawers > Settings". Draws each dictionary item in a collapsed foldout with the key in the header and the value inside the box. Draws each dictionary item in an expanded foldout with the key in the header and the value inside the box. Customize the behavior for dictionaries in the inspector. Specify an alternative key label for the dictionary drawer. Specify an alternative value label for the dictionary drawer. Specify how the dictionary should draw its items. Gets or sets a value indicating whether this instance is read only. Gets or sets a value indicating the default key column width of the dictionary. DisableContextMenu is used on any property and disables the context menu for that property. Use this if you do not want the context menu to be available for a property. The following example shows how DisableContextMenu is used on a property. public class MyComponent : MonoBehaviour { [DisableContextMenu] public Vector3 MyVector; } Whether to disable the context menu for the member itself. Whether to disable the context menu for collection elements. Initializes a new instance of the class. Whether to disable the context menu for the member itself. Whether to also disable the context menu of collection elements. DisableIf is used on any property, and can disable or enable the property in the inspector. Use this to disable properties when they are irrelevant. The following example shows how a property can be disabled by the state of a field. public class MyComponent : MonoBehaviour { public bool DisableProperty; [DisableIf("DisableProperty")] public int MyInt; public SomeEnum SomeEnumField; [DisableIf("SomeEnumField", SomeEnum.SomeEnumMember)] public string SomeString; } The following examples show how a property can be disabled by a function. public class MyComponent : MonoBehaviour { [EnableIf("MyDisableFunction")] public int MyInt; private bool MyDisableFunction() { // ... } } The name of a bool member field, property or method. Obsolete; use the Condition member instead. A resolved string that defines the condition to check the value of, such as a member name or an expression. The optional condition value. Disables a property in the inspector, based on the value of a resolved string. A resolved string that defines the condition to check the value of, such as a member name or an expression. Disables a property in the inspector, if the resolved string evaluates to the specified value. A resolved string that defines the condition to check the value of, such as a member name or an expression. Value to check against. DisableInEditorMode is used on any property, and disables the property when not in play mode. Use this when you only want a property to be editable when in play mode. The following example shows how DisableInEditorMode is used to disable a property when in the editor. public class MyComponent : MonoBehaviour { [DisableInEditorMode] public int MyInt; } DisableInPlayMode is used on any property, and disables the property when in play mode. Use this to prevent users from editing a property when in play mode. The following example shows how DisableInPlayMode is used to disable a property when in play mode. public class MyComponent : MonoBehaviour { [DisableInPlayMode] public int MyInt; } DisplayAsString is used on any property, and displays a string in the inspector as text. Use this for when you want to show a string in the inspector, but not allow for any editing. DisplayAsString uses the property's ToString method to display the property as a string. The following example shows how DisplayAsString is used to display a string property as text in the inspector. public class MyComponent : MonoBehaviour { [DisplayAsString] public string MyInt = 5; // You can combine with to display a message in the inspector. [DisplayAsString, HideLabel] public string MyMessage = "This string will be displayed as text in the inspector"; [DisplayAsString(false)] public string InlineMessage = "This string is very long, but has been configured to not overflow."; } If true, the string will overflow past the drawn space and be clipped when there's not enough space for the text. If false the string will expand to multiple lines, if there's not enough space when drawn. Displays the property as a string in the inspector. Displays the property as a string in the inspector. Value indicating if the string should overflow past the available space, or expand to multiple lines when there's not enough horizontal space. DontApplyToListElements is used on other attributes, and indicates that those attributes should be applied only to the list, and not to the elements of the list. Use this on attributes that should only work on a list or array property as a whole, and not on each element of the list. The following example shows how DontApplyToListElements is used on . [DontApplyToListElements] [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)] public sealed class VisibleIfAttribute : Attribute { public string MemberName { get; private set; } public VisibleIfAttribute(string memberName) { this.MemberName = memberName; } } DrawWithUnity can be applied to a field or property to make Odin draw it using Unity's old drawing system. Use it if you want to selectively disable Odin drawing for a particular member. Note that this attribute does not mean "disable Odin completely for this property"; it is visual only in nature, and in fact represents an Odin drawer which calls into Unity's old property drawing system. As Odin is still ultimately responsible for arranging the drawing of the property, and since other attributes exist with a higher priority than this attribute, and it is not guaranteed that Unity will draw the property if another attribute is present to override this one. The inline button adds a button to the end of a property. Due to a bug, multiple inline buttons are currently not supported. The following examples demonstrates how InlineButton can be used. public class MyComponent : MonoBehaviour { // Adds a button to the end of the A property. [InlineButton("MyFunction")] public int A; // This is example demonstrates how you can change the label of the button. // InlineButton also supports refering to string members with $. [InlineButton("MyFunction", "Button")] public int B; private void MyFunction() { // ... } } Name of member method to call when the button is clicked. Obsolete; use the Action member instead. A resolved string that defines the action to perform when the button is clicked, such as an expression or method invocation. Optional label of the button. Optional resolved string that specifies a condition for whether to show the inline button or not. Draws a button to the right of the property. A resolved string that defines the action to perform when the button is clicked, such as an expression or method invocation. Optional label of the button. Not yet documented. Not yet documented. Not yet documented. Not yet documented. Not yet documented. Not yet documented. ShowForPrefabOnlyAttribute is used on any field or property, and only shows properties from prefab assets inspector. Use this to ensure the same value on a property, across all instances of a prefab. On non-prefab objects or instances, this attribute does nothing, and allows properties to be edited as normal. The following example shows how ShowForPrefabOnlyAttribute is used on properties. public class MyComponent { [ShowForPrefabOnlyAttribute] public int MyInt; } EnableForPrefabOnly is used on any field or property, and only allows editing of values from prefab assets inspector. Use this to ensure the same value on a property, across all instances of a prefab. On non-prefab objects or instances, this attribute does nothing, and allows properties to be edited as normal. The following example shows how EnableForPrefabOnly is used on properties. public class MyComponent { [EnableForPrefabOnly] public int MyInt; } EnableIf is used on any property, and can enable or disable the property in the inspector. Use this to enable properties when they are relevant. The following example shows how a property can be enabled by the state of a field. public class MyComponent : MonoBehaviour { public bool EnableProperty; [EnableIf("EnableProperty")] public int MyInt; public SomeEnum SomeEnumField; [EnableIf("SomeEnumField", SomeEnum.SomeEnumMember)] public string SomeString; } The following examples show how a property can be enabled by a function. public class MyComponent : MonoBehaviour { [EnableIf("MyEnableFunction")] public int MyInt; private bool MyEnableFunction() { // ... } } The name of a bool member field, property or method. Obsolete; use the Condition member instead. A resolved string that defines the condition to check the value of, such as a member name or an expression. The optional condition value. Enables a property in the inspector, based on the value of a resolved string. A resolved string that defines the condition to check the value of, such as a member name or an expression. Enables a property in the inspector, if the resolved string evaluates to the specified value. A resolved string that defines the condition to check the value of, such as a member name or an expression. Value to check against. Draws an enum in a horizontal button group instead of a dropdown. public class MyComponent : MonoBehvaiour { [EnumToggleButtons] public MyBitmaskEnum MyBitmaskEnum; [EnumToggleButtons] public MyEnum MyEnum; } [Flags] public enum MyBitmaskEnum { A = 1 << 1, // 1 B = 1 << 2, // 2 C = 1 << 3, // 4 ALL = A | B | C } public enum MyEnum { A, B, C } HideIf is used on any property and can hide the property in the inspector. Use this to hide irrelevant properties based on the current state of the object. This example shows a component with fields hidden by the state of another field. public class MyComponent : MonoBehaviour { public bool HideProperties; [HideIf("HideProperties")] public int MyInt; [HideIf("HideProperties", false)] public string MyString; public SomeEnum SomeEnumField; [HideIf("SomeEnumField", SomeEnum.SomeEnumMember)] public string SomeString; } This example shows a component with a field that is hidden when the game object is inactive. public class MyComponent : MonoBehaviour { [HideIf("MyVisibleFunction")] public int MyHideableField; private bool MyVisibleFunction() { return !this.gameObject.activeInHierarchy; } } The name of a bool member field, property or method. Obsolete; use the Condition member instead. A resolved string that defines the condition to check the value of, such as a member name or an expression. The optional condition value. Whether or not to slide the property in and out when the state changes. Hides a property in the inspector, based on the value of a resolved string. A resolved string that defines the condition to check the value of, such as a member name or an expression. Whether or not to slide the property in and out when the state changes. Hides a property in the inspector, if the resolved string evaluates to the specified value. A resolved string that defines the condition to check the value of, such as a member name or an expression. Value to check against. Whether or not to slide the property in and out when the state changes. HideInPlayMode is used on any property, and hides the property when not in editor mode. Use this when you only want a property to only be visible the editor. The following example shows how HideInPlayMode is used to hide a property when in play mode. public class MyComponent : MonoBehaviour { [HideInPlayMode] public int MyInt; } HideInEditorMode is used on any property, and hides the property when not in play mode. Use this when you only want a property to only be visible play mode. The following example shows how HideInEditorMode is used to hide a property when in the editor. public class MyComponent : MonoBehaviour { [HideInEditorMode] public int MyInt; } Apply HideMonoScript to your class to prevent the Script property from being shown in the inspector. This attribute has the same effect on a single type that the global configuration option "Show Mono Script In Editor" in "Preferences -> Odin Inspector -> General -> Drawers" has globally when disabled. The following example shows how to use this attribute. [HideMonoScript] public class MyComponent : MonoBehaviour { // The Script property will not be shown for this component in the inspector } Hides the polymorphic object-picker shown above the properties of non-Unity serialized reference types. When the object picker is hidden, you can right click and set the instance to null, in order to set a new value. If you don't want this behavior, you can use attribute to ensure people can't change the value. public class MyComponent : SerializedMonoBehaviour { [Header("Hidden Object Pickers")] [Indent] [HideReferenceObjectPicker] public MyCustomReferenceType OdinSerializedProperty1; [Indent] [HideReferenceObjectPicker] public MyCustomReferenceType OdinSerializedProperty2; [Indent] [Header("Shown Object Pickers")] public MyCustomReferenceType OdinSerializedProperty3; [Indent] public MyCustomReferenceType OdinSerializedProperty4; public class MyCustomReferenceType { public int A; public int B; public int C; } } HorizontalGroup is used group multiple properties horizontally in the inspector. The width can either be specified as percentage or pixels. All values between 0 and 1 will be treated as a percentage. If the width is 0 the column will be automatically sized. Margin-left and right can only be specified in pixels. The following example shows how three properties have been grouped together horizontally. // The width can either be specified as percentage or pixels. // All values between 0 and 1 will be treated as a percentage. // If the width is 0 the column will be automatically sized. // Margin-left and right can only be specified in pixels. public class HorizontalGroupAttributeExamples : MonoBehaviour { [HorizontalGroup] public int A; [HideLabel, LabelWidth (150)] [HorizontalGroup(150)] public LayerMask B; // LabelWidth can be helpfull when dealing with HorizontalGroups. [HorizontalGroup("Group 1"), LabelWidth(15)] public int C; [HorizontalGroup("Group 1"), LabelWidth(15)] public int D; [HorizontalGroup("Group 1"), LabelWidth(15)] public int E; // Having multiple properties in a column can be achived using multiple groups. Checkout the "Combining Group Attributes" example. [HorizontalGroup("Split", 0.5f, PaddingRight = 15)] [BoxGroup("Split/Left"), LabelWidth(15)] public int L; [BoxGroup("Split/Right"), LabelWidth(15)] public int M; [BoxGroup("Split/Left"), LabelWidth(15)] public int N; [BoxGroup("Split/Right"), LabelWidth(15)] public int O; // Horizontal Group also has supprot for: Title, MarginLeft, MarginRight, PaddingLeft, PaddingRight, MinWidth and MaxWidth. [HorizontalGroup("MyButton", MarginLeft = 0.25f, MarginRight = 0.25f)] public void SomeButton() { } } The width. Values between 0 and 1 will be treated as percentage, 0 = auto, otherwise pixels. The margin left. Values between 0 and 1 will be treated as percentage, 0 = ignore, otherwise pixels. The margin right. Values between 0 and 1 will be treated as percentage, 0 = ignore, otherwise pixels. The padding left. Values between 0 and 1 will be treated as percentage, 0 = ignore, otherwise pixels. The padding right. Values between 0 and 1 will be treated as percentage, 0 = ignore, otherwise pixels. The minimum Width. Values between 0 and 1 will be treated as percentage, 0 = ignore, otherwise pixels. The maximum Width. Values between 0 and 1 will be treated as percentage, 0 = ignore, otherwise pixels. Adds a title above the horizontal group. The label width, 0 = auto. Organizes the property in a horizontal group. The group for the property. The width of the property. Values between 0 and 1 are interpolated as a percentage, otherwise pixels. The left margin in pixels. The right margin in pixels. The order of the group in the inspector. Organizes the property in a horizontal group. The width of the property. Values between 0 and 1 are interpolated as a percentage, otherwise pixels. The left margin in pixels. The right margin in pixels. The order of the group in the inspector. Merges the values of two group attributes together. The other group to combine with. InlineAttribute is used on any property or field with a type that inherits from UnityEngine.Object. This includes components and assets etc. public class InlineEditorExamples : MonoBehaviour { [DisableInInlineEditors] public Vector3 DisabledInInlineEditors; [HideInInlineEditors] public Vector3 HiddenInInlineEditors; [InlineEditor] public Transform InlineComponent; [InlineEditor(InlineEditorModes.FullEditor)] public Material FullInlineEditor; [InlineEditor(InlineEditorModes.GUIAndHeader)] public Material InlineMaterial; [InlineEditor(InlineEditorModes.SmallPreview)] public Material[] InlineMaterialList; [InlineEditor(InlineEditorModes.LargePreview)] public GameObject InlineObjectPreview; [InlineEditor(InlineEditorModes.LargePreview)] public Mesh InlineMeshPreview; } If true, the inline editor will start expanded. Draw the header editor header inline. Draw editor GUI inline. Draw editor preview inline. Maximum height of the inline editor. If the inline editor exceeds the specified height, a scrollbar will appear. Values less or equals to zero will let the InlineEditor expand to its full size. The size of the editor preview if drawn together with GUI. The size of the editor preview if drawn alone. If false, this will prevent the InlineEditor attribute from incrementing the InlineEditorAttributeDrawer.CurrentInlineEditorDrawDepth. This is helpful in cases where you want to draw the entire editor, and disregard attributes such as [] and []. How the InlineEditor attribute drawer should draw the object field. Whether to set GUI.enabled = false when drawing an editor for an asset that is locked by source control. Defaults to true. Initializes a new instance of the class. The inline editor mode. How the object field should be drawn. Initializes a new instance of the class. How the object field should be drawn. SuppressInvalidAttributeError is used on members to suppress the inspector error message you get when applying an attribute to a value that it's not supposed to work on. This can be very useful for applying attributes to generic parameter values, when it only applies to some of the possible types that the value might become. The following example shows a case where the attribute might be useful. public class NamedValue<T> { public string Name; // The Range attribute will be applied if T is compatible with it, but if T is not compatible, an error will not be shown. [SuppressInvalidAttributeError, Range(0, 10)] public T Value; } Editor modes for Draws only the editor GUI Draws the editor GUI and the editor header. Draws the editor GUI to the left, and a small editor preview to the right. Draws a small editor preview without any GUI. Draws a large editor preview without any GUI. Draws the editor header and GUI to the left, and a small editor preview to the right. ShowDrawerChain lists all prepend, append and value drawers being used in the inspector. This is great in situations where you want to debug, and want to know which drawers might be involved in drawing the property. Your own custom drawers are highlighted with a green label. Drawers, that have not been called during the draw chain, will be greyed out in the inspector to make it clear which drawers have had an effect on the properties. public class MyComponent : MonoBehaviour { [ShowDrawerChain] public int IndentedInt; } Marks a type as being specially serialized. Odin uses this attribute to check whether it should include non-Unity-serialized members in the inspector. FoldoutGroup is used on any property, and organizes properties into a foldout. Use this to organize properties, and to allow the user to hide properties that are not relevant for them at the moment. The following example shows how FoldoutGroup is used to organize properties into a foldout. public class MyComponent : MonoBehaviour { [FoldoutGroup("MyGroup")] public int A; [FoldoutGroup("MyGroup")] public int B; [FoldoutGroup("MyGroup")] public int C; } The following example shows how properties can be organizes into multiple foldouts. public class MyComponent : MonoBehaviour { [FoldoutGroup("First")] public int A; [FoldoutGroup("First")] public int B; [FoldoutGroup("Second")] public int C; } Gets a value indicating whether or not the foldout should be expanded by default. Gets a value indicating whether or not the Expanded property has been set. Adds the property to the specified foldout group. Name of the foldout group. The order of the group in the inspector. Adds the property to the specified foldout group. Name of the foldout group. Whether or not the foldout should be expanded by default. The order of the group in the inspector. Combines the foldout property with another. The group to combine with. GUIColor is used on any property and changes the GUI color used to draw the property. The following example shows how GUIColor is used on a properties to create a rainbow effect. public class MyComponent : MonoBehaviour { [GUIColor(1f, 0f, 0f)] public int A; [GUIColor(1f, 0.5f, 0f, 0.2f)] public int B; [GUIColor("GetColor")] public int C; private Color GetColor() { return this.A == 0 ? Color.red : Color.white; } } The GUI color of the property. The name of a local field, member or property that returns a Color. Both static and instance methods are supported. Sets the GUI color for the property. The red channel. The green channel. The blue channel. The alpha channel. Sets the GUI color for the property. Specify the name of a local field, member or property that returns a Color. HideLabel is used on any property, and hides the label in the inspector. Use this to hide the label of properties in the inspector. The following example show how HideLabel is used to hide the label of a game object property. public class MyComponent : MonoBehaviour { [HideLabel] public GameObject MyGameObjectWithoutLabel; } Indent is used on any property and moves the property's label to the right. Use this to clearly organize properties in the inspector. The following example shows how a property is indented by Indent. public class MyComponent : MonoBehaviour { [Indent] public int IndentedInt; } Indicates how much a property should be indented. Indents a property in the inspector. How much a property should be indented. InfoBox is used on any property, and display a text box above the property in the inspector. Use this to add comments or warn about the use of different properties. The following example shows different info box types. public class MyComponent : MonoBehaviour { [InfoBox("This is an int property")] public int MyInt; [InfoBox("This info box is a warning", InfoMessageType.Warning)] public float MyFloat; [InfoBox("This info box is an error", InfoMessageType.Error)] public object MyObject; [InfoBox("This info box is just a box", InfoMessageType.None)] public Vector3 MyVector; } The following example how info boxes can be hidden by fields and properties. public class MyComponent : MonoBehaviour { [InfoBox("This info box is hidden by an instance field.", "InstanceShowInfoBoxField")] public int MyInt; public bool InstanceShowInfoBoxField; [InfoBox("This info box is hideable by a static field.", "StaticShowInfoBoxField")] public float MyFloat; public static bool StaticShowInfoBoxField; [InfoBox("This info box is hidden by an instance property.", "InstanceShowInfoBoxProperty")] public int MyOtherInt; public bool InstanceShowInfoBoxProperty { get; set; } [InfoBox("This info box is hideable by a static property.", "StaticShowInfoBoxProperty")] public float MyOtherFloat; public static bool StaticShowInfoBoxProperty { get; set; } } The following example shows how info boxes can be hidden by functions. public class MyComponent : MonoBehaviour { [InfoBox("This info box is hidden by an instance function.", "InstanceShowFunction")] public int MyInt; public bool InstanceShowFunction() { return this.MyInt == 0; } [InfoBox("This info box is hidden by a static function.", "StaticShowFunction")] public short MyShort; public bool StaticShowFunction() { return true; } // You can also specify a function with the same type of parameter. // Use this to specify the same function, for multiple different properties. [InfoBox("This info box is hidden by an instance function with a parameter.", "InstanceShowParameterFunction")] public GameObject MyGameObject; public bool InstanceShowParameterFunction(GameObject property) { return property != null; } [InfoBox("This info box is hidden by a static function with a parameter.", "StaticShowParameterFunction")] public Vector3 MyVector; public bool StaticShowParameterFunction(Vector3 property) { return property.magnitude == 0f; } } The message to display in the info box. The type of the message box. Optional member field, property or function to show and hide the info box. When true the InfoBox will ignore the GUI.enable flag and always draw as enabled. Displays an info box above the property. The message for the message box. Supports referencing a member string field, property or method by using $. The type of the message box. Name of member bool to show or hide the message box. Displays an info box above the property. The message for the message box. Supports referencing a member string field, property or method by using $. Name of member bool to show or hide the message box. Draw a special slider the user can use to specify a range between a min and a max value. Uses a Vector2 where x is min and y is max. The following example shows how MinMaxSlider is used. public class Player : MonoBehaviour { [MinMaxSlider(4, 5)] public Vector2 SpawnRadius; } The hardcoded min value for the slider. The hardcoded max value for the slider. The name of a field, property or method to get the min value from. Obsolete; use MinValueGetter instead. A resolved string that should evaluate to a float value, which is used as the min bounds. The name of a field, property or method to get the max value from. Obsolete; use MaxValueGetter instead. A resolved string that should evaluate to a float value, which is used as the max bounds. The name of a Vector2 field, property or method to get the min max values from. Obsolete; use MinMaxValueGetter instead. A resolved string that should evaluate to a Vector2 value, which is used as the min/max bounds. If this is non-null, it overrides the behaviour of the MinValue, MinValueGetter, MaxValue and MaxValueGetter members. Draw float fields for min and max value. Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max. The min value. The max value. If true number fields will drawn next to the MinMaxSlider. Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max. A resolved string that should evaluate to a float value, which is used as the min bounds. The max value. If true number fields will drawn next to the MinMaxSlider. Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max. The min value. A resolved string that should evaluate to a float value, which is used as the max bounds. If true number fields will drawn next to the MinMaxSlider. Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max. A resolved string that should evaluate to a float value, which is used as the min bounds. A resolved string that should evaluate to a float value, which is used as the max bounds. If true number fields will drawn next to the MinMaxSlider. Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max. A resolved string that should evaluate to a Vector2 value, which is used as the min/max bounds. If this is non-null, it overrides the behaviour of the MinValue, MinValueGetter, MaxValue and MaxValueGetter members. If true number fields will drawn next to the MinMaxSlider. Draws the checkbox before the label instead of after. ToggleLeftAttribute can be used an all fields and properties of type boolean public class MyComponent : MonoBehaviour { [ToggleLeft] public bool MyBoolean; } LabelText is used to change the labels of properties. Use this if you want a different label than the name of the property. The following example shows how LabelText is applied to a few property fields. public MyComponent : MonoBehaviour { [LabelText("1")] public int MyInt1; [LabelText("2")] public int MyInt2; [LabelText("3")] public int MyInt3; } The new text of the label. Whether the label text should be nicified before it is displayed, IE, "m_someField" becomes "Some Field". If the label text is resolved via a member reference, an expression, or the like, then the evaluated result of that member reference or expression will be nicified. Give a property a custom label. The new text of the label. Give a property a custom label. The new text of the label. Whether to nicify the label text. Customize the behavior for lists and arrays in the inspector. This example shows how you can add your own custom add button to a list. [ListDrawerSettings(HideAddButton = true, OnTitleBarGUI = "DrawTitleBarGUI")] public List<MyType> SomeList; #if UNITY_EDITOR private void DrawTitleBarGUI() { if (SirenixEditorGUI.ToolbarButton(EditorIcons.Plus)) { this.SomeList.Add(new MyType()); } } #endif This attribute is scheduled for refactoring. If true, the add button will not be rendered in the title toolbar. You can use OnTitleBarGUI to implement your own add button. true if [hide add button]; otherwise, false. If true, the remove button will not be rendered on list items. You can use OnBeginListElementGUI and OnEndListElementGUI to implement your own remove button. true if [hide remove button]; otherwise, false. Specify the name of a member inside each list element which defines the label being drawn for each list element. Override the default behaviour for adding objects to the list. If the referenced member returns the list type element, it will be called once per selected object. If the referenced method returns void, it will only be called once regardless of how many objects are selected. Calls a method before each list element. The member referenced must have a return type of void, and an index parameter of type int which represents the element index being drawn. Calls a method after each list element. The member referenced must have a return type of void, and an index parameter of type int which represents the element index being drawn. If true, object/type pickers will never be shown when the list add button is clicked, and default(T) will always be added instantly instead, where T is the element type of the list. Whether adding a new element should copy the last element. False by default. A resolved string with "int index" and "Color defaultColor" parameters that lets you control the color of individual elements. Override the default setting specified in the Advanced Odin Preferences window and explicitly tell whether paging should be enabled or not. Override the default setting specified in the Advanced Odin Preferences window and explicitly tell whether items should be draggable or not. Override the default setting specified in the Advanced Odin Preferences window and explicitly tells how many items each page should contain. Mark a list as read-only. This removes all editing capabilities from the list such as Add, Drag and delete, but without disabling GUI for each element drawn as otherwise would be the case if the was used. Override the default setting specified in the Advanced Odin Preferences window and explicitly tell whether or not item count should be shown. Override the default setting specified in the Advanced Odin Preferences window and explicitly tell whether or not the list should be expanded or collapsed by default. If true, a label is drawn for each element which shows the index of the element. Use this to inject custom GUI into the title-bar of the list. Whether the Paging property is set. Whether the ShowItemCount property is set. Whether the NumberOfItemsPerPage property is set. Whether the Draggable property is set. Whether the IsReadOnly property is set. Whether the Expanded property is set. Whether the ShowIndexLabels property is set. MaxValue is used on primitive fields. It caps value of the field to a maximum value. Use this to define a maximum value for the field. Note that this attribute only works in the editor! Values changed from scripting will not be capped at a maximum. The following example shows a component where a speed value must be less than or equal to 200. public class Car : MonoBehaviour { // The speed of the car must be less than or equal to 200. [MaxValue(200)] public float Speed; } The following example shows how MaxValue can be combined with . public class Health : MonoBehaviour { // The speed value must be between 0 and 200. [MinValue(0), MaxValue(200)] public float Speed; } The maximum value for the property. The string with which to resolve a maximum value. This could be a field, property or method name, or an expression. Sets a maximum value for the property in the inspector. The max value. Sets a maximum value for the property in the inspector. The string with which to resolve a maximum value. This could be a field, property or method name, or an expression. MinValue is used on primitive fields. It caps value of the field to a minimum value. Use this to define a minimum value for the field. Note that this attribute only works in the editor! Values changed from scripting will not be capped at a minimum. The following example shows a player component that must have at least 1 life. public class Player : MonoBehaviour { // The life value must be set to at least 1. [MinValue(1)] public int Life; } The following example shows how MinValue can be combined with public class Health : MonoBehaviour { // The health value must be between 0 and 100. [MinValue(0), MaxValue(100)] public float Health; } The minimum value for the property. The string with which to resolve a minimum value. This could be a field, property or method name, or an expression. Sets a minimum value for the property in the inspector. The minimum value. Sets a minimum value for the property in the inspector. The string with which to resolve a minimum value. This could be a field, property or method name, or an expression. MultiLineProperty is used on any string property. Use this to allow users to edit strings in a multi line textbox. MultiLineProperty is similar to Unity's but can be applied to both fields and properties. The following example shows how MultiLineProperty is applied to properties. public class MyComponent : MonoBehaviour { [MultiLineProperty] public string MyString; [ShowInInspector, MultiLineProperty(10)] public string PropertyString; } The number of lines for the text box. Makes a multiline textbox for editing strings. The number of lines for the text box. PropertyTooltip is used on any property, and creates tooltips for when hovering the property in the inspector. Use this to explain the purpose, or how to use a property. This is similar to Unity's but can be applied to both fields and properties. The following example shows how PropertyTooltip is applied to various properties. public class MyComponent : MonoBehaviour { [PropertyTooltip("This is an int property.")] public int MyField; [ShowInInspector, PropertyTooltip("This is another int property.")] public int MyProperty { get; set; } } The message shown in the tooltip. Adds a tooltip to the property in the inspector. The message shown in the tooltip. ReadOnly is used on any property, and disabled the property from being changed in the inspector. Use this for when you want to see the value of a property in the inspector, but don't want it to be changed. This attribute only affects the inspector! Values can still be changed by script. The following example shows how a field can be displayed in the editor, but not be editable. public class Health : MonoBehaviour { public int MaxHealth; [ReadOnly] public int CurrentHealth; } ReadOnly can also be combined with . public class Health : MonoBehaviour { public int MaxHealth; [ShowInInspector, ReadOnly] private int currentHealth; } OnInspectorGUI is used on any property, and will call the specified function whenever the inspector code is running. Use this to create custom inspector GUI for an object. public MyComponent : MonoBehaviour { [OnInspectorGUI] private void MyInspectorGUI() { GUILayout.Label("Label drawn from callback"); } } The following example shows how a callback can be set before another property. public MyComponent : MonoBehaviour { [OnInspectorGUI("MyInspectorGUI", false)] public int MyField; private void MyInspectorGUI() { GUILayout.Label("Label before My Field property"); } } The following example shows how callbacks can be added both before and after a property. public MyComponent : MonoBehaviour { [OnInspectorGUI("GUIBefore", "GUIAfter")] public int MyField; private void GUIBefore() { GUILayout.Label("Label before My Field property"); } private void GUIAfter() { GUILayout.Label("Label after My Field property"); } } The resolved action string that defines the action to be invoked before the property is drawn, if any. The resolved action string that defines the action to be invoked after the property is drawn, if any. The name of the method to be called before the property is drawn, if any. Obsolete; use the Prepend member instead. The name of the method to be called after the property is drawn, if any. Obsolete; use the Append member instead. Calls a function decorated with this attribute, when the inspector is being drawn. Adds callbacks to the specified action when the property is being drawn. The resolved action string that defines the action to be invoked. If true the method will be called after the property has been drawn. Otherwise the method will be called before. Adds callbacks to the specified actions when the property is being drawn. The resolved action string that defines the action to be invoked before the property is drawn, if any. The resolved action string that defines the action to be invoked after the property is drawn, if any. OnValueChanged works on properties and fields, and calls the specified function whenever the value has been changed via the inspector. Note that this attribute only works in the editor! Properties changed by script will not call the function. The following example shows how OnValueChanged is used to provide a callback for a property. public class MyComponent : MonoBehaviour { [OnValueChanged("MyCallback")] public int MyInt; private void MyCallback() { // .. } } The following example show how OnValueChanged can be used to get a component from a prefab property. public class MyComponent : MonoBehaviour { [OnValueChanged("OnPrefabChange")] public GameObject MyPrefab; // RigidBody component of MyPrefab. [SerializeField, HideInInspector] private RigidBody myPrefabRigidbody; private void OnPrefabChange() { if(MyPrefab != null) { myPrefabRigidbody = MyPrefab.GetComponent<Rigidbody>(); } else { myPrefabRigidbody = null; } } } Name of callback member function. Obsolete; use the Action member instead. A resolved string that defines the action to perform when the value is changed, such as an expression or method invocation. Whether to perform the action when a child value of the property is changed. Whether to perform the action when an undo or redo event occurs via UnityEditor.Undo.undoRedoPerformed. True by default. Whether to perform the action when the property is initialized. This will generally happen when the property is first viewed/queried (IE when the inspector is first opened, or when its containing foldout is first expanded, etc), and whenever its type or a parent type changes, or it is otherwise forced to rebuild. Adds a callback for when the property's value is changed. A resolved string that defines the action to perform when the value is changed, such as an expression or method invocation. Whether to perform the action when a child value of the property is changed. Attribute to derive from if you wish to create a new property group type, such as box groups or tab groups. Note that this attribute has special behaviour for "combining" several attributes into one, as one group, may be declared across attributes in several members, completely out of order. See . All group attributes for a group with the same name (and of the same attribute type) are combined into a single representative group attribute using the method, which is called by the method. This behaviour is a little unusual, but it is important that you understand it when creating groups with many custom parameters that may have to be combined. This example shows how could be implemented. [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] public class BoxGroupAttribute : PropertyGroupAttribute { public string Label { get; private set; } public bool ShowLabel { get; private set; } public bool CenterLabel { get; private set; } public BoxGroupAttribute(string group, bool showLabel = true, bool centerLabel = false, float order = 0) : base(group, order) { this.Label = group; this.ShowLabel = showLabel; this.CenterLabel = centerLabel; } protected override void CombineValuesWith(PropertyGroupAttribute other) { // The given attribute parameter is *guaranteed* to be of type BoxGroupAttribute. var attr = other as BoxGroupAttribute; // If this attribute has no label, we the other group's label, thus preserving the label across combines. if (this.Label == null) { this.Label = attr.Label; } // Combine ShowLabel and CenterLabel parameters. this.ShowLabel |= attr.ShowLabel; this.CenterLabel |= attr.CenterLabel; } } The ID used to grouping properties together. The name of the group. This is the last part of the group ID if there is a path, otherwise it is just the group ID. The order of the group. Whether to hide the group by default when all its children are not visible. True by default. If not null, this resolved string controls the group's visibility. Note that if is true, there must be *both* a visible child *and* this condition must be true, before the group is shown. Whether to animate the visibility changes of this group or make the visual transition instantly. True by default. Initializes a new instance of the class. The group identifier. The group order. Initializes a new instance of the class. The group identifier. Combines this attribute with another attribute of the same type. This method invokes the virtual method to invoke custom combine logic. All group attributes are combined to one attribute used by a single OdinGroupDrawer. Example: protected override void CombineValuesWith(PropertyGroupAttribute other) { this.Title = this.Title ?? (other as MyGroupAttribute).Title; } The attribute to combine with. The instance that the method was invoked on. The argument 'other' was null. Attributes to combine are not of the same type. or PropertyGroupAttributes to combine must have the same group id. Override this method to add custom combine logic to your group attribute. This method determines how your group's parameters combine when spread across multiple attribute declarations in the same class. Remember, in .NET, member order is not guaranteed, so you never know which order your attributes will be combined in. The attribute to combine with. This parameter is guaranteed to be of the correct attribute type. This example shows how attributes are combined. protected override void CombineValuesWith(PropertyGroupAttribute other) { // The given attribute parameter is *guaranteed* to be of type BoxGroupAttribute. var attr = other as BoxGroupAttribute; // If this attribute has no label, we the other group's label, thus preserving the label across combines. if (this.Label == null) { this.Label = attr.Label; } // Combine ShowLabel and CenterLabel parameters. this.ShowLabel |= attr.ShowLabel; this.CenterLabel |= attr.CenterLabel; } PropertyOrder is used on any property, and allows for ordering of properties. Use this to define in which order your properties are shown. Lower order values will be drawn before higher values. There is unfortunately no way of ensuring that properties are in the same order, as they appear in your class. PropertyOrder overcomes this. The following example shows how PropertyOrder is used to order properties in the inspector. public class MyComponent : MonoBehaviour { [PropertyOrder(1)] public int MySecondProperty; [PropertyOrder(-1)] public int MyFirstProperty; } The order for the property. Initializes a new instance of the class. Defines a custom order for the property. The order for the property. Required is used on any object property, and draws a message in the inspector if the property is missing. Use this to clearly mark fields as necessary to the object. The following example shows different uses of the Required attribute. public class MyComponent : MonoBehaviour { [Required] public GameObject MyPrefab; [Required(InfoMessageType.Warning)] public Texture2D MyTexture; [Required("MyMesh is nessessary for this component.")] public Mesh MyMesh; [Required("MyTransform might be important.", InfoMessageType.Info)] public Transform MyTransform; } The message of the info box. The type of the info box. Adds an error box to the inspector, if the property is missing. Adds an info box to the inspector, if the property is missing. The message to display in the error box. The type of info box to draw. Adds an error box to the inspector, if the property is missing. The message to display in the error box. Adds an info box to the inspector, if the property is missing. The type of info box to draw. SceneObjectsOnly is used on object properties, and restricts the property to scene objects, and not project assets. Use this when you want to ensure an object is a scene object, and not from a project asset. The following example shows a component with a game object property, that must be from a scene, and not a prefab asset. public MyComponent : MonoBehaviour { [SceneObjectsOnly] public GameObject MyPrefab; } ValueDropdown is used on any property and creates a dropdown with configurable options. Use this to give the user a specific set of options to select from. Due to a bug in Unity, enums will sometimes not work correctly. The last example shows how this can be fixed. The following example shows a how the ValueDropdown can be used on an int property. public class MyComponent : MonoBehaviour { [ValueDropdown("myValues")] public int MyInt; // The selectable values for the dropdown. private int[] myValues = { 1, 2, 3 }; } The following example shows how ValueDropdownList can be used for objects, that do not implement a usable ToString. public class MyComponent : MonoBehaviour { [ValueDropdown("myVectorValues")] public Vector3 MyVector; // The selectable values for the dropdown, with custom names. private ValueDropdownList<Vector3> myVectorValues = new ValueDropdownList<Vector3>() { {"Forward", Vector3.forward }, {"Back", Vector3.back }, {"Up", Vector3.up }, {"Down", Vector3.down }, {"Right", Vector3.right }, {"Left", Vector3.left }, }; } The following example shows how the ValueDropdown can on any member that implements IList. public class MyComponent : MonoBehaviour { // Member field of type float[]. private float[] valuesField; [ValueDropdown("valuesField")] public float MyFloat; // Member property of type List<thing>. private List<string> ValuesProperty { get; set; } [ValueDropdown("ValuesProperty")] public string MyString; // Member function that returns an object of type IList. private IList<ValueDropdownItem<int>> ValuesFunction() { return new ValueDropdownList<int> { { "The first option", 1 }, { "The second option", 2 }, { "The third option", 3 }, }; } [ValueDropdown("ValuesFunction")] public int MyInt; } Due to a bug in Unity, enums member arrays will in some cases appear as empty. This example shows how you can get around that. public class MyComponent : MonoBehaviour { // Make the field static. private static MyEnum[] MyStaticEnumArray = MyEnum[] { ... }; // Force Unity to serialize the field, and hide the property from the inspector. [SerializeField, HideInInspector] private MyEnum MySerializedEnumArray = MyEnum[] { ... }; } Name of any field, property or method member that implements IList. E.g. arrays or Lists. Obsolete; use the ValuesGetter member instead. A resolved string that should evaluate to a value that is assignable to IList; e.g, arrays and lists are compatible. The number of items before enabling search. Default is 10. False by default. True by default. If the ValueDropdown attribute is applied to a list, then disabling this, will render all child elements normally without using the ValueDropdown. The ValueDropdown will still show up when you click the add button on the list drawer, unless is true. False by default. If the ValueDropdown attribute is applied to a list, and is set to true, then enabling this, will exclude existing values, instead of rendering a checkbox indicating whether the item is already included or not. If the dropdown renders a tree-view, then setting this to true will ensure everything is expanded by default. If true, instead of replacing the drawer with a wide dropdown-field, the dropdown button will be a little button, drawn next to the other drawer. Disables the the GUI for the appended drawer. False by default. By default, a single click selects and confirms the selection. By default, the dropdown will create a tree view. Gets or sets the width of the dropdown. Default is zero. Gets or sets the height of the dropdown. Default is zero. Gets or sets the title for the dropdown. Null by default. False by default. Whether to draw all child properties in a foldout. Whether values selected by the value dropdown should be copies of the original or references (in the case of reference types). Defaults to true. Creates a dropdown menu for a property. A resolved string that should evaluate to a value that is assignable to IList; e.g, arrays and lists are compatible. Gets the label for the dropdown item. The label text for the item. Gets the value of the dropdown item. The value for the item. Use this with to specify custom names for values. The type of the value. Adds the specified value with a custom name. The name of the item. The value. Adds the specified value. The value. The name of the item. The value of the item. Initializes a new instance of the class. The text to display for the dropdown item. The value for the dropdown item. The name of this item. Gets the text. Gets the value. The name of the item. The value of the item. Initializes a new instance of the class. The text to display for the dropdown item. The value for the dropdown item. Gets the text. Gets the value. The name of this item. 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. This can for example be combined with to allow for live debugging of values. 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; } } TabGroup is used on any property, and organizes properties into different tabs. Use this to organize different value to make a clean and easy to use inspector. Use groups to create multiple tab groups, each with multiple tabs and even sub tabs. The following example shows how to create a tab group with two tabs. public class MyComponent : MonoBehaviour { [TabGroup("First")] public int MyFirstInt; [TabGroup("First")] public int AnotherInt; [TabGroup("Second")] public int MySecondInt; } The following example shows how multiple groups of tabs can be created. public class MyComponent : MonoBehaviour { [TabGroup("A", "FirstGroup")] public int FirstGroupA; [TabGroup("B", "FirstGroup")] public int FirstGroupB; // The second tab group has been configured to have constant height across all tabs. [TabGroup("A", "SecondGroup", true)] public int SecondgroupA; [TabGroup("B", "SecondGroup")] public int SecondGroupB; [TabGroup("B", "SecondGroup")] public int AnotherInt; } This example demonstrates how multiple tabs groups can be combined to create tabs in tabs. public class MyComponent : MonoBehaviour { [TabGroup("ParentGroup", "First Tab")] public int A; [TabGroup("ParentGroup", "Second Tab")] public int B; // Specify 'First Tab' as a group, and another child group to the 'First Tab' group. [TabGroup("ParentGroup/First Tab/InnerGroup", "Inside First Tab A")] public int C; [TabGroup("ParentGroup/First Tab/InnerGroup", "Inside First Tab B")] public int D; [TabGroup("ParentGroup/Second Tab/InnerGroup", "Inside Second Tab")] public int E; } The default tab group name which is used when the single-parameter constructor is called. Name of the tab. Should this tab be the same height as the rest of the tab group. If true, the content of each page will not be contained in any box. If true, the tab group will be hidden if it only contains one tab. Organizes the property into the specified tab in the default group. Default group name is '_DefaultTabGroup' The tab. if set to true [use fixed height]. The order. Organizes the property into the specified tab in the specified group. The group to attach the tab to. The name of the tab. Set to true to have a constant height across the entire tab group. The order of the group. Name of all tabs in this group. Combines the tab group with another group. The other group. Not yet documented. Not yet documented. Not yet documented. Not yet documented. Title is used to make a bold header above a property. The following example shows how Title is used on different properties. public class TitleExamples : MonoBehaviour { [Title("Titles and Headers")] [InfoBox( "The Title attribute has the same purpose as Unity's Header attribute," + "but it also supports properties, and methods." + "\n\nTitle also offers more features such as subtitles, options for horizontal underline, bold text and text alignment." + "\n\nBoth attributes, with Odin, supports either static strings, or refering to members strings by adding a $ in front.")] public string MyTitle = "My Dynamic Title"; public string MySubtitle = "My Dynamic Subtitle"; [Title("Static title")] public int C; public int D; [Title("Static title", "Static subtitle")] public int E; public int F; [Title("$MyTitle", "$MySubtitle")] public int G; public int H; [Title("Non bold title", "$MySubtitle", bold: false)] public int I; public int J; [Title("Non bold title", "With no line seperator", horizontalLine: false, bold: false)] public int K; public int L; [Title("$MyTitle", "$MySubtitle", TitleAlignments.Right)] public int M; public int N; [Title("$MyTitle", "$MySubtitle", TitleAlignments.Centered)] public int O; public int P; [Title("$Combined", titleAlignment: TitleAlignments.Centered)] public int Q; public int R; [ShowInInspector] [Title("Title on a Property")] public int S { get; set; } [Title("Title on a Method")] [Button] public void DoNothing() { } public string Combined { get { return this.MyTitle + " - " + this.MySubtitle; } } } The title displayed above the property in the inspector. Optional subtitle. If true the title will be displayed with a bold font. Gets a value indicating whether or not to draw a horizontal line below the title. Title alignment. Creates a title above any property in the inspector. The title displayed above the property in the inspector. Optional subtitle Title alignment Horizontal line If true the title will be drawn with a bold font. Toggle is used on any field or property, and allows to enable or disable the property in the inspector. Use this to create a property that can be turned off or on. Toggle does current not support any static members for toggling. The following example shows how Toggle is used to create a toggleable property. public class MyComponent : MonoBehaviour { [Toggle("Enabled")] public MyToggleable MyToggler = new MyToggleable(); } public class MyToggleable { public bool Enabled; public int MyValue; } Name of any bool field or property to enable or disable the object. If true, all other open toggle groups will collapse once another one opens. Create a togglable property in the inspector. Name of any bool field or property to enable or disable the object. ToggleGroup is used on any field, and create a toggleable group of options. Use this to create options that can be enabled or disabled. The functions as the ID for the ToggleGroup, and therefore all members of a toggle group must specify the same toggle member. This attribute does not support static members! The following example shows how ToggleGroup is used to create two separate toggleable groups. public class MyComponent : MonoBehaviour { // This attribute has a title specified for the group. The title only needs to be applied to a single attribute for a group. [ToggleGroup("FirstToggle", order: -1, groupTitle: "First")] public bool FirstToggle; [ToggleGroup("FirstToggle")] public int MyInt; // This group specifies a member string as the title of the group. A property or a function can also be used. [ToggleGroup("SecondToggle", titleStringMemberName: "SecondGroupTitle")] public bool SecondToggle { get; set; } [ToggleGroup("SecondToggle")] public float MyFloat; [HideInInspector] public string SecondGroupTitle = "Second"; } "/> Title of the toggle group in the inspector. If null will be used instead. If true, all other open toggle groups will collapse once another one opens. Creates a ToggleGroup. See . Name of any bool field or property to enable or disable the ToggleGroup. The order of the group. Use this to name the group differently than toggleMemberName. Creates a ToggleGroup. See . Name of any bool field or property to enable or disable the ToggleGroup. Use this to name the group differently than toggleMemberName. Obsolete constructor overload. Obsolete overload. Obsolete overload. Obsolete overload. Obsolete overload. Name of any bool field, property or function to enable or disable the ToggleGroup. Name of any string field, property or function, to title the toggle group in the inspector. If null will be used instead. Combines the ToggleGroup with another ToggleGroup. Another ToggleGroup. ValidateInput is used on any property, and allows to validate input from inspector. Use this to enforce correct values. ValidateInput refuses invalid values. ValidateInput only works in the editor. Values changed through scripting will not be validated. The following examples shows how a speed value can be forced to be above 0. public class MyComponent : MonoBehaviour { [ValidateInput("ValidateInput")] public float Speed; // Specify custom output message and message type. [ValidateInput("ValidateInput", "Health must be more than 0!", InfoMessageType.Warning)] public float Health; private bool ValidateInput(float property) { return property > 0f; } } The following example shows how a static function could also be used. public class MyComponent : MonoBehaviour { [ValidateInput("StaticValidateFunction")] public int MyInt; private static bool StaticValidateFunction(int property) { return property != 0; } } Default message for invalid values. OBSOLETE; use the Condition member instead. A resolved string that should evaluate to a boolean value, and which should validate the input. Note that in expressions, the $value named parameter, and in methods, a parameter named value, can be used to get the validated value instead of referring to the value by its containing member. This makes it easier to reuse validation strings. A resolved string that should evaluate to a boolean value, and which should validate the input. Note that in expressions, the $value named parameter, and in methods, a parameter named value, can be used to get the validated value instead of referring to the value by its containing member. This makes it easier to reuse validation strings. The type of the message. Whether to also trigger validation when changes to child values happen. This is true by default. If true, the validation method will not only be executed when the User has changed the value. It'll run once every frame in the inspector. Initializes a new instance of the class. A resolved string that should evaluate to a boolean value, and which should validate the input. Note that in expressions, the $value named parameter, and in methods, a parameter named value, can be used to get the validated value instead of referring to the value by its containing member. This makes it easier to reuse validation strings. Default message for invalid values. Type of the message. Obsolete. Rejecting invalid input is no longer supported. Use the other constructors instead. Obsolete overload. Obsolete overload. Obsolete overload. Obsolete overload. ShowIf is used on any property and can hide the property in the inspector. Use this to hide irrelevant properties based on the current state of the object. This example shows a component with fields hidden by the state of another field. public class MyComponent : MonoBehaviour { public bool ShowProperties; [ShowIf("showProperties")] public int MyInt; [ShowIf("showProperties", false)] public string MyString; public SomeEnum SomeEnumField; [ShowIf("SomeEnumField", SomeEnum.SomeEnumMember)] public string SomeString; } This example shows a component with a field that is hidden when the game object is inactive. public class MyComponent : MonoBehaviour { [ShowIf("MyVisibleFunction")] public int MyHideableField; private bool MyVisibleFunction() { return this.gameObject.activeInHierarchy; } } The name of a bool member field, property or method. Obsolete; use the Condition member instead. A resolved string that defines the condition to check the value of, such as a member name or an expression. The optional condition value. Whether or not to slide the property in and out when the state changes. Shows a property in the inspector, based on the value of a resolved string. A resolved string that defines the condition to check the value of, such as a member name or an expression. Whether or not to slide the property in and out when the state changes. Shows a property in the inspector, if the resolved string evaluates to the specified value. A resolved string that defines the condition to check the value of, such as a member name or an expression. Value to check against. Whether or not to slide the property in and out when the state changes. Wrap is used on most primitive property, and allows for wrapping the value when it goes out of the defined range. Use this when you want a value that goes around in circle, like for example an angle. Currently unsigned primitives are not supported. The following example show how Wrap is used on a property. public class MyComponent : MonoBehaviour { [Wrap(-100, 100)] public float MyFloat; } The lowest value for the property. The highest value for the property. Wraps the value of the property round when the values goes out of range. The lowest value for the property. The highest value for the property. Type of info message box. This enum matches Unity's MessageType enum which could not be used since it is located in the UnityEditor assembly. Generic message box with no type. Information message box. Warning message box. Error message box.