Sirenix.OdinInspector.Editor
An ActionResolver resolves a string to an action, given an InspectorProperty instance to use as context. Call to get an instance of an ActionResolver.
Action resolvers are a globally extendable system that can be hooked into and modified or changed by creating and registering an .
See Odin's tutorials for details and examples of how to use ActionResolvers.
The context of this ActionResolver, containing all of its configurations and values it needs to function. For performance and simplicity reasons, this is a single very large struct that is passed around by ref to anything that needs it.
The delegate that executes the actual action. You should not call this manually, but instead call .
The current error message that the resolver has, or null if there is no error message. This is a shortcut for writing "resolver.Context.ErrorMessage".
Whether there is an error message at the moment. This is a shortcut for writing "resolver.Context.ErrorMessage != null".
Draws an error message box if there is an error, and does nothing if there is no error.
Executes the resolved action for a given selection index.
The selection index to execute the action on. Defaults to 0.
Executes the action for all selection indices.
Creates a new action resolver instance from a pre-built context struct. This is a more advanced use that requires you to
know how the context needs to be set up before action resolution happens. However, this allows you to do more advanced
things like adjust various context values before string resolution happens.
The pre-built context that should be used to get a resolver.
Creates a new action resolver instance for a given string.
The property that is the context for the resolution to happen in.
The string that should be resolved to an action.
Creates a new action resolver instance for a given string.
The property that is the context for the resolution to happen in.
The string that should be resolved to an action.
The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg.
Gets a nicely formatted string that lists all the errors in the given set of action resolvers. The returned value is null if there are no errors.
Gets a nicely formatted string that lists all the errors in the given set of action resolvers. The returned value is null if there are no errors.
Draws error boxes for all errors in the given action resolvers, or does nothing if there are no errors. This is equivalent to calling DrawError() on all resolvers passed to this method.
Draws error boxes for all errors in the given action resolvers, or does nothing if there are no errors. This is equivalent to calling DrawError() on all resolvers passed to this method.
This struct contains all of an ActionResolver's configurations and values it needs to function. For performance and simplicity reasons, this is a single very large struct that lives on an ActionResolver instance and is passed around by ref to anything that needs it.
The property that *provides* the context for the action resolution. This is the instance that was passed to the resolver when it was created. Note that this is different from , which is based on this value, but almost always isn't the same InspectorProperty instance.
The error message, if a valid action resolution wasn't found, or if creation of the action resolver failed because was invalid, or if the action was executed but threw an exception. (In this last case, will be true.)
The named values that are available to the action resolver. Use this field only to get and set named values - once the ValueResolver has been created, new named values will have no effect.
This will be true if is not null and the message was caused by an exception thrown by code invoked during execution of the resolved action.
Whether exceptions thrown during action execution should be logged to the console.
The string that is resolved to perform an action.
Whether the action resolver should sync ref parameters of invoked methods with named values. If this is true, then if a ref or out parameter value is changed during action execution, the named value associated with that parameter will also be changed to the same value.
Whether this context has been resolved.
The type that is the parent of the action resolution, ie, the type that is the context. This is the same as .ValueEntry.TypeOfValue.
The property that *is* the context for the action resolution. This is not the instance that was passed to the resolver when it was created, but this value is based on that instance. This is the property that provides the actual context - for example, if is for a member of a type - or for an element in a collection contained by a member - this value will be the parent property for the type that contains that member. Only if is the tree's root property is the same as .
Gets the parent value which provides the context of the resolver.
The selection index of the parent value to get.
Sets the parent value which provides the context of the resolver.
The selection index of the parent value to set.
The value to set.
Adds the default named values of "property" and "value" to the context's named values.
This method is usually automatically invoked when a resolver is created, so there
is no need to invoke it manually.
A color palette.
Name of the color palette.
The colors.
Whether to show the alpha channel.
Add, Edit or remove custom color palettes used by the .
You can modify the configuration in the Odin Preferences window found in 'Tools -> Odin Inspector -> Preferences -> Drawers -> Color Palettes',
or by locating the configuration file stored as a serialized object in the Sirenix folder under 'Odin Inspector/Config/Editor/ColorPaletteManager'.
Specify the amount of spacing between each color in a color palette.
Specify the width of each color in a color palette. If StretchPalette is set to true, this will become the min-width.
If true, all color in a color palette is stretch so that the entire color-palette area is filled.
If true, a toolbar with the name of the color palette is shown above each color palette.
Gives you the list of all custom color palettes.
Remember to call UnityEditor.EditorUtility.SetDirty(ColorPaletteManager.Instance) after modifying the list.
Configurations for Odin DLLs import settings.
Gets or sets a value indicating whether or not Odin should automatically configure the import settings of its DLLs in a preprocess build step.
Keep in mind that this feature is only supported by Unity version 5.6 and up.
Gets a value indicating whether or not automatic configuration of Odin's DLL import settings is supported by the current Unity version.
Installed Odin Inspector Version Info.
Gets the name of the current running version of Odin Inspector.
Gets the current running version of Odin Inspector.
Whether the current version of Odin is an enterprise version.
This is a class for creating, getting and modifying a property's various states. An instance of this class always comes attached to an InspectorProperty.
See Odin's tutorials for more information about usage of the state system.
If set to true, all state changes for this property will be logged to the console.
Whether the property is visible in the inspector.
Whether the Visible state was true or not during the last layout event.
Whether the property is enabled in the inspector.
Whether the Enabled state was true or not during the last layout event.
Whether the property is expanded in the inspector.
Whether the Expanded state was true or not during the last layout event.
Creates a custom state with a given name.
Determines whether a state with the given key exists.
The key to check.
True if the state exists, otherwise, false.
Determines whether a state with the given key exists.
The key to check.
If the state exists, this out parameter will be true if the state is persistent.
True if the state exists, otherwise, false.
Determines whether a state with the given key exists.
The key to check.
If the state exists, this out parameter will contain the type of value that the state contains.
True if the state exists, otherwise, false.
Determines whether a state with the given key exists.
The key to check.
If the state exists, this out parameter will be true if the state is persistent.
If the state exists, this out parameter will contain the type of value that the state contains.
True if the state exists, otherwise, false.
Gets the value of a given state as an instance of type T.
The type to get the state value as. An will be thrown if the state's value type cannot be assigned to T.
The key of the state to get. An will be thrown if a state with the given key does not exist.
The value of the state.
Gets the value that a given state contained last layout as an instance of type T.
The type to get the state value as. An will be thrown if the state's value type cannot be assigned to T.
The key of the state to get. An will be thrown if a state with the given key does not exist.
The value of the state during the last layout event.
Sets the value of a given state to a given value.
The type to set the state value as. An will be thrown if T cannot be assigned to the state's value type.
The key of the state to set the value of. An will be thrown if a state with the given key does not exist.
The value to set.
Cleans the property state and prepares it for cached reuse of its containing PropertyTree. This will also reset the state.
Resets all states to their default values. Persistent states will be updated to their persistent cached value if one exists.
Contains information about a change that is going to occur/has occurred to a collection.
Specifies the kinds of changes that can occur to collections.
Unknown collection change, the change was not specified by the invoking code.
The change is adding a value to the collection. Value and SelectionIndex will be set.
The change is inserting a value into the collection. Index, Value and SelectionIndex will be set.
The change is removing a value from the collection. Value and SelectionIndex will be set.
The change is removing a value at an index from the collection. Index and SelectionIndex will be set.
The change is clearing the collection. SelectionIndex will be set.
The change is removing a key from the collection. Key and SelectionIndex will be set.
The change is setting the value of a key in the collection. Key, Value and SelectionIndex will be set.
Handles all prefab modifications that apply to the targets of a property tree, if any. This class determines which properties have modifications, what the modifications are, auto-applies modifications if the current instance values do not correspond to the prefab values, and also provides an API for modifying those modifications.
NOTE: This class is liable to see a lot of changes, as the prefab modification system is slated to be redesigned for increased extendability in the future. Do not depend overly on the current API.
The prefabs for each prefab instance represented by the property tree, if any.
Whether any of the values the property tree represents are prefab instances.
A prefab tree for the prefabs of this property tree's prefab instances, if any exist.
Gets the Unity PropertyModification for the property at this path, if there are any.
The property path to get the modification for.
The index of the tree target to get the modification for.
Whether any children of the path have modifications registered.
Gets the Odin prefab modification type of a given property, if any.
The property to check.
The prefab modification type of the property if it has one, otherwise null.
Registers a modification of type for a given property.
The property to register a modification for.
Selection index of the target to register a modification for.
The modified list length.
Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property.
or
newLength cannot be negative!
Registers a modification of type for a given property.
The property to register a modification for.
Selection index of the target to register a modification for.
Whether to force the change to be registered immediately, rather than at the end of frame.
Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property.
Calculates a delta between the current dictionary property and its prefab counterpart, and registers that delta as a modification.
The property to register a modification for.
Selection index of the target.
Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property.
Adds a remove key modification to the dictionary modifications of a given property.
The property to register a modification for.
Selection index of the target.
The key to be removed.
Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property.
Adds an add key modification to the dictionary modifications of a given property.
The property to register a modification for.
Selection index of the target.
The key to be added.
Property " + property.Path + " does not have a value entry; cannot register prefab modification to this property.
Removes all dictionary modifications on a property for a given dictionary key value.
The property to remove a key modification for.
Selection index of the target.
The key to remove modifications for.
key
Removes all prefab modifications of a given type on a given property.
The property to remove modifications for.
Selection index of the target.
Type of the modification to remove.
Gets all prefab modifications in this property tree for a given selection index.
Default implementation and the version that will be used when no other OdinAttributeProcessorLocator instance have been given to a PropertyTree.
This implementation will find all AttributeProcessor definitions not marked with the .
Singleton instance of the DefaultOdinAttributeProcessorLocator class.
Type search index used for matching to properties.
Gets a list of to process attributes for the specified child member of the parent property.
The parent of the member.
Child member of the parent property.
List of to process attributes for the specified member.
Gets a list of to process attributes for the specified property.
The property to find attribute porcessors for.
List of to process attributes for the speicied member.
This attribute processor will take any attribute already applied to the property with the applied to,
and take all attributes applied to the attribute (except any ) and add to them to the property.
This allows for adding attributes to attributes in the property system.
Looks for attributes in the attributes list with a applied, and adds the attribute from those attributes to the property.
The parent of the member.
The member that is being processed.
The list of attributes currently applied to the property.
Finds all attributes attached to the specified member and adds to them to attribute list.
This attribute processor can only process for members.
The property to process.
false.
Finds all attributes attached to the specified member and adds to them to the attributes list.
The parent property of the specified member.
The member to process attributes for.
The current attributes applied to the property.
Attribute processor that can add, change and remove attributes from a property.
Instanciates an OdinAttributeProcessor instance of the specified type.
The type of processor to instanciate. The type must inherit from .
A new instance of the specified type.
Checks if the processor can process attributes for the specified member.
The parent property of the member.
The member to be processed.
true if the processor can process for the specified member. Otherwise false.
Checks if the processor can process attributes for the specified property.
The property to process.
true if the processor can process attributes for the specified property. Otherwise false.
Processes attributes for the specified member.
The parent property of the specified member.
The member to process attributes for.
The current attributes applied to the property.
Processes attributes for the specified property.
The property to process attributes for.
The current attributes applied to the property.
Attribute processor that can add, change and remove attributes from a property.
Base class definition for OdinAttributeProcessorLocator. Responsible for finding and creating instances to process attributes for properties.
Default OdinAttributeProcessorLocator have been implemented as .
Gets a list of to process attributes for the specified child member of the parent property.
The parent of the member.
Child member of the parent property.
List of to process attributes for the specified member.
Gets a list of to process attributes for the specified property.
The property to find attribute porcessors for.
List of to process attributes for the speicied member.
Find attributes attached to the type definition of a property and adds to them to attribute list.
This attribute processor can only process for properties.
The parent of the specified member.
The member to process.
false.
This attribute processor can only process for properties with an attached value entry.
The property to process.
true if the specified property has a value entry. Otherwise false.
Finds all attributes attached to the type and base types of the specified property value and adds them to the attribute list.
The property to process.
The list of attributes for the property.
Default implementation and the version that will be used by if no other instance have been specified.
Singleton instance of .
Gets an instance for the specified property.
The property to get an instance for.
An instance of to resolver the specified property.
Base class for locator of . Use for default implementation.
Gets an instance for the specified property.
The property to get an instance for.
An instance of to resolver the specified property.
Note: this interface may be temporary, and may eventually be substituted for a public-facing way of extending the prefab modification system.
For now, it only exists to denote which internally defined resolvers support prefab modifications being set.
Responsible for getting and setting values on properties.
The type of the owner.
The type of the value.
Whether the value is readonly.
Gets the type of the owner.
Gets the type of the value.
Initializes a new instance of the class.
The field member to represent.
if set to true [is readonly].
Initializes a new instance of the class.
The getter.
The setter.
getter
Initializes a new instance of the class.
The getter.
The setter.
getter
Gets the value from a given owner.
The owner.
The found value.
owner is null
Gets the value from a given weakly typed owner.
The weakly typed owner.
The found value.
Sets the weakly typed value on a given weakly typed owner.
The owner.
The value.
Sets the value on a given owner.
The owner.
The value.
Gets all s for a given type.
The parent property.
The type to get infos for.
if set to true members that are serialized by Odin will be included.
Gets an aliased version of a member, with the declaring type name included in the member name, so that there are no conflicts with private fields and properties with the same name in different classes in the same inheritance hierarchy.
Gets the attribute that the OdinAttributeStateUpdater applies to.
Gets the strongly typed ValueEntry of the OdinAttributeStateUpdater's property.
Gets the strongly typed ValueEntry of the OdinValueStateUpdater's property.
Initializes this instance.
Draws the property with GUILayout support. This method is called by DrawPropertyImplementation if the GUICallType is set to GUILayout, which is the default.
Draws members marked with .
Draws a warning message for non-serialized properties that sports both the SerializeField and the ShowInInspector attribute.
Determines if the drawer can draw the property.
The property to test.
true if the drawer can draw the property; otherwise false.
Initializes the drawer.
Draws the warning message and calls the next drawer.
The label for the property.
Draws properties marked with .
Draws a space for properties marked with the PropertySpace attribute.
Initializes this instance.
Draws the property.
Drawer for the ShowPropertyResolver attribute.
TextArea attribute drawer.
Draws the property in the Rect provided. This method does not support the GUILayout, and is only called by DrawPropertyImplementation if the GUICallType is set to Rect, which is not the default.
If the GUICallType is set to Rect, both GetRectHeight and DrawPropertyRect needs to be implemented.
If the GUICallType is set to GUILayout, implementing DrawPropertyLayout will suffice.
The label. This can be null, so make sure your drawer supports that.
Draws properties marked with .
Initializes this instance.
Draws the property with GUILayout support. This method is called by DrawPropertyImplementation if the GUICallType is set to GUILayout, which is the default.
Drawer for the ResponsiveButtonGroupAttribute.
Draws the property with GUILayout support.
Drawer for the attribute.
Draws the property.
The default method drawer that draws most buttons.
Initializes this instance.
Draws the property layout.
Draws Color properties marked with .
Draws the property.
Draws char properties marked with .
Draws the property.
Draws string properties marked with .
Draws the property.
Draws sbyte properties marked with .
Draws the property.
Draws byte properties marked with .
Draws the property.
Draws short properties marked with .
Draws the property.
Draws ushort properties marked with .
Draws the property.
Draws int properties marked with .
Draws the property.
Draws uint properties marked with .
Draws the property.
Draws long properties marked with .
Draws the property.
Draws ulong properties marked with .
Draws the property.
Draws float properties marked with .
Draws the property.
Draws double properties marked with .
Draws the property.
Draws decimal properties marked with .
Draws the property.
Odin drawer for the .
Returns true if the drawer can draw the type.
Draws the property.
Draws properties marked with as 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.
Draws the property.
The TableList attirbute drawer.
Determines whether this instance [can draw attribute property] the specified property.
Initializes this instance.
Draws the property layout.
Draws Color properties marked with .
Draws the property.
Draws properties marked with .
Not yet documented.
Initializes the drawer.
Not yet documented.
Not yet documented.
Initializes the drawer.
Not yet documented.
Adds customs generic menu options.
Draws properties marked with
Draws the property.
Draws properties marked with the .
Draws the attribute.
When first learning to use the Odin Inspector, it is common for people to misunderstand the OdinSerialize attribute,
and use it in places where it does not achive the deceired goal.
This drawer will display a warning message if the OdinSerialize attribute is potentially used in such cases.
Draws The Property.
Common base implementation for progress bar attribute drawers.
Initialized the drawer.
Draws the property.
Generic implementation of progress bar field drawing.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a byte property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a sbyte property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a short property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a ushort property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for an int property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a uint property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a long property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a ulong property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a float property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a double property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws values decorated with .
Draws a progress bar for a decimal property.
Converts the generic value to a double.
The generic value to convert.
The generic value as a double.
Draws byte properties marked with .
Initialized the drawer.
Draws the property.
Draws double properties marked with .
Initialized the drawer.
Draws the property.
Draws float properties marked with .
Initialized the drawer.
Draws the property.
Draws decimal properties marked with .
Initialized the drawer.
Draws the property.
Draws short properties marked with .
Initialized the drawer.
Draws the property.
Draws int properties marked with .
Initialized the drawer.
Draws the property.
Draws long properties marked with .
Initialized the drawer.
Draws the property.
Draws sbyte properties marked with .
Initialized the drawer.
Draws the property.
Draws ushort properties marked with .
Initialized the drawer.
Draws the property.
Draws uint properties marked with .
Initialized the drawer.
Draws the property.
Draws ulong properties marked with .
Initialized the drawer.
Draws the property.
Draws an enum in a horizontal button group instead of a dropdown.
Returns true if the drawer can draw the type.
Draws the property.
Not yet documented.
Not yet documented.
Draws char properties marked with .
Draws the property.
Draws string properties marked with .
Draws the property.
Draws sbyte properties marked with .
Draws the property.
Draws byte properties marked with .
Draws the property.
Draws short properties marked with .
Draws the property.
Draws ushort properties marked with .
Draws the property.
Draws int properties marked with .
Draws the property.
Draws uint properties marked with .
Draws the property.
Draws long properties marked with .
Draws the property.
Draws ulong properties marked with .
Draws the property.
Draws float properties marked with .
Draws the property.
Draws double properties marked with .
Draws the property.
Draws decimal properties marked with .
Draws the property.
Draws properties marked with .
Initializes this instance.
Draws the property.
Draws properties marked with .
This drawer sets the current GUI color, before calling the next drawer in the chain.
Draws the property.
Static GUI information reguarding the InlineEditor attribute.
Gets a value indicating how many InlineEditors we are currently in.
Draws properties marked with .
Initializes this instance.
Draws the property layout.
The label.
Draws Vector2 properties marked with .
Show drawer chain attribute drawer.
Draws the property.
Draws properties marked with .
Initializes this instance.
Draws the property.
Draws properties marked with .
Draws the property.
Draws properties marked with .
Draws the property.
Draws byte properties marked with .
Draws the property.
Draws double properties marked with .
Draws the property.
Draws float properties marked with .
Draws the property.
Draws decimal properties marked with .
Draws the property.
Draws short properties marked with .
Draws the property.
Draws int properties marked with .
Draws the property.
Draws long properties marked with .
Draws the property.
Draws sbyte properties marked with .
Draws the property.
Draws ushort properties marked with .
Draws the property.
Draws uint properties marked with .
Draws the property.
Draws ulong properties marked with .
Draws the property.
Draws properties marked with .
Calls the properties ToString method to get the string to draw.
Draws the property.
Drawer for the
Draws the property.
Drawer for the
Draws the property.
Draws properties marked with .
Draws the property.
Char property drawer.
Draws the property.
Delegate property drawer. This drawer is rather simplistic for now, and will receive significant upgrades in the future.
See .
Draws the property.
Property drawer for .
Draws the property.
Base class to derive from for value drawers that merely wish to cause a value to be drawn by Unity.
Draws the property.
Gradient property drawer.
Int property drawer.
Draws the property.
The GUIStyleState Drawer
Initializes this instance.
Draws the property with GUILayout support.
LayerMask property drawer.
Draws the property.
Base class for two-dimensional array drawers.
Override this method in order to define custom type constraints to specify whether or not a type should be drawn by the drawer.
Note that Odin's has full support for generic class constraints, so most often you can get away with not overriding CanDrawTypeFilter.
Not yet documented.
Not yet documented.
Draws the property.
This method gets called from DrawPropertyLayout right before the table and error message is drawn.
Compares the element.
Draws a table cell element.
The rect.
The input value.
The output value.
Draws the element.
Property drawer for nullables.
Draws the property.
Quaternion property drawer.
Draws the property.
Populates the generic menu for the property.
Type property drawer
Draws the property.
Draws properties marked with .
Displays a configurable list of assets, where each item can be enabled or disabled.
Draws the property.
Populates the generic menu for the property.
Odin drawer for .
Initializes the drawer.
Not yet documented.
Adds a generic menu option to properties marked with .
Populates the generic menu for the property.
Draws the property.
Draws properties marked with .
Draws the property.
Draws properties marked with .
Draws the property.
Draws properties marked with .
Draws the property.
Draws properties marked with .
Draws an info box above the property. Error and warning info boxes can be tracked by Odin Scene Validator.
Draws the property.
Draws properties marked with .
Creates a new GUIContent, with the provided label text, before calling further down in the drawer chain.
Draws the attribute.
Draws string properties marked with .
This drawer only works for string fields, unlike .
Draws the property.
Draws string properties marked with .
This drawer works for both string field and properties, unlike .
Draws the property.
Draws properties marked with .
Calls the method, the attribute is either attached to, or the method that has been specified in the attribute, to allow for custom GUI drawing.
Draws the property.
Draws properties marked with .
Draws properties marked with .
Draws the property.
Initializes this instance.
Draws the property with GUILayout support. This method is called by DrawPropertyImplementation if the GUICallType is set to GUILayout, which is the default.
Draws properties marked with .
Draws the property.
Draws properties marked with .
Draws the property.
Draws properties marked with .
Draws the property.
Draws all Unity DecoratorDrawers within prepend attribute drawers within Odin.
Initializes the class.
Draws the property.
Draws all properties grouped together with the
Initializes this instance.
Draws the property.
Draws all properties grouped together with the
Draws the property.
Draws all properties grouped together with the
Initializes this instance.
Draws the property.
Draws all properties grouped together with the
Draws the property.
Draws properties marked with .
Draws the property.
Draws all properties grouped together with the
Draws the property.
Draws all nullable reference types, with an object field.
Draws the property.
Returns a value that indicates if this drawer can be used for the given property.
Evaluates all strings, enums and primitive types and ensures EditorGUI.showMixedValue is true if there are any value conflicts in the current selection.
Sets the drawer to only be evaluated on primitive types, strings and enums.
Draws the property.
Adds the right click area.
Adds the right click area.
Opens a context menu for any given property on right click. The context menu is populated by all relevant drawers that implements .
Initializes the drawer.
Draws the property.
Draws all reference type properties, which has already been drawn elsewhere. This drawer adds an additional foldout to prevent infinite draw depth.
Prevents the drawer from being applied to UnityEngine.Object references since they are shown as an object field, and is not drawn in-line.
Draws the property.
Draws properties with a set.
Draws the property.
When multiple objects are selected and inspected, this his drawer ensures UnityEditor.EditorGUI.showMixedValue
gets set to true if there are any conflicts in the selection for any given property.
Otherwise the next drawer is called.
This drawer also implements and provides a right-click context menu item for resolving conflicts if any.
Draws the property.
Animation curve property drawer.
Bool property drawer.
Draws the property.
Byte property drawer.
Draws the property.
Color32 property drawer.
Draws the property.
Color property drawer.
Draws the property.
Color palette property drawer.
Draws the property.
Drawer for composite properties.
Draws the property.
Decimal property drawer.
Draws the property.
Double property drawer.
Draws the property.
Enum property drawer.
Returns true if the drawer can draw the type.
Draws the property.
Short property drawer.
Draws the property.
Int property drawer.
Draws the property.
Long property drawer.
Draws the property.
Property drawer for anything that has a .
Initializes the drawer.
Draws the property.
SByte property drawer.
Draws the property.
Float property drawer.
Draws the property.
String property drawer.
Draws the property.
Ushort property drawer.
Draws the property.
Uint property drawer.
Draws the property.
Ulong property drawer.
Draws the property.
Unity event drawer.
Draws the property.
Unity object drawer.
Initializes this instance.
Draws the property.
Vector2 proprety drawer.
Draws the property.
Populates the generic menu for the property.
Vector3 property drawer.
Draws the property.
Populates the generic menu for the property.
Vector4 property drawer.
Draws the property.
Populates the generic menu for the property.
Draws the property.
Descripes an attribute example.
The type of the example object.
The name of the example.
The description of the example.
Raw code of the example.
The example declared as a Unity component.
Sorting value of the example. Examples with lower order values should come before examples with higher order values.
Preview object of the example.
Extension method for List<Attribute>
Determines whether the list contains a specific attribute.
The type of attribute.
The attribute list.
true if the specified attribute list has attribute; otherwise, false.
Adds the attribute if not exist.
The type of attribute.
The attribute list.
Adds the attribute if not exist.
The type of attribute.
The attribute list.
Adds the attribute if not exist.
The type of attribute.
The attribute list.
Adds the attribute if not exist.
The type of attribute.
The attribute list.
The attribute.
Removes the type of the attribute of.
The type of attribute.
The attribute list.
Odin has its own implementations for these attribute drawers; never use Unity's.
Gets the priority of a given drawer type.
Helper class to get values from InspectorProperties. This class is deprecated and fully replaced by .
If any error occurred while looking for members, it will be stored here.
Gets the referenced member information.
Gets the value.
Gets all values from all targets.
The content padding
Draws the menu tree.
Gets the value selected value.
Invokes BuildMenuTree.
Use this attribute to prevent a type from being included in Odin systems.
The attribute can be applied to Odin drawers, Odin property resolvers and Odin attribute processor types.
To safely change anything in the type cache, you must be holding this lock.
Put this attribute on a validator class to prevent the ValidatorDrawer from running that validator in the inspector.
Typically you would use this for a validation-related attribute that has its own, complex custom drawer that should
handle the validation and error/warning drawing while the inspector is being drawn, but still needs a validator to
run for the project validation scans.
Apply this to an assembly to register validators for the validation system.
This enables locating of all relevant validator types very quickly.
This attribute can be placed on an assembly to register a value resolver creator that should be queried when a value resolver is being created.
This attribute can be placed on an assembly to register a value resolver creator that should be queried when a value resolver is being created.
The resolver
A ValueResolver resolves a string to a value of a given type, given an InspectorProperty instance to use as context. Call to get an instance of a ValueResolver.
Value resolvers are a globally extendable system that can be hooked into and modified or changed by creating and registering a .
See Odin's tutorials for details and examples of how to use ValueResolvers.
The context of this ValueResolver, containing all of its configurations and values it needs to function. For performance and simplicity reasons, this is a single very large struct that is passed around by ref to anything that needs it.
The current error message that the resolver has, or null if there is no error message. This is a shortcut for writing "resolver.Context.ErrorMessage".
Whether there is an error message at the moment. This is a shortcut for writing "resolver.Context.ErrorMessage != null".
The type of value that this resolver instance is supposed to get.
Gets a value from the value resolver in a weakly typed manner.
The selection index at which to get the value, in the case of multi-selection. Defaults to 0.
The value that was gotten.
Draws an error message box if there is an error, and does nothing if there is no error.
Creates a new value resolver instance from a pre-built context struct, in a weakly typed fashion, though the result
is the same as using a strongly typed generic overload. This is a more advanced use that requires you to
know how the context needs to be set up before value resolution happens. However, this allows you to do more advanced
things like adjust various context values before string resolution happens.
The pre-built context that should be used to get a resolver.
Creates a new value resolver instance from a pre-built context struct. This is a more advanced use that requires you to
know how the context needs to be set up before value resolution happens. However, this allows you to do more advanced
things like adjust various context values before string resolution happens.
The pre-built context that should be used to get a resolver.
Creates a new value resolver instance in a weakly typed fashion, though the result is the same as using a strongly typed generic overload.
This is useful when you don't know at compile time which type you want to resolve.
The type of value that the new resolver should resolve.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
Creates a new value resolver instance in a weakly typed fashion, though the result is the same as using a strongly typed generic overload.
This is useful when you don't know at compile time which type you want to resolve.
The type of value that the new resolver should resolve.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg.
Creates a new value resolver instance.
The type of value that the new resolver should resolve.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
Creates a new value resolver instance.
The type of value that the new resolver should resolve.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg.
Creates a new value resolver instance in a weakly typed fashion, though the result is the same as using a strongly typed generic overload.
This is useful when you don't know at compile time which type you want to resolve.
The type of value that the new resolver should resolve.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
The value that the resolver should return if the string cannot be resolved to anything, or if there is an error in creating a resolver, or if resolution itself throws an exception.
Creates a new value resolver instance in a weakly typed fashion, though the result is the same as using a strongly typed generic overload.
This is useful when you don't know at compile time which type you want to resolve.
The type of value that the new resolver should resolve.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
The value that the resolver should return if the string cannot be resolved to anything, or if there is an error in creating a resolver, or if resolution itself throws an exception.
The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg.
Creates a new value resolver instance meant to resolve a string value in particular. This is a shorthand for creating a string resolver that has the resolved string as a fallback value.
This special case will get you the behaviour where, if you pass in a string that is not meant to be resolved in a special way, the value resolver will just pass you that string back as the result value.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
Creates a new value resolver instance meant to resolve a string value in particular. This is a shorthand for creating a string resolver that has the resolved string as a fallback value.
This special case will get you the behaviour where, if you pass in a string that is not meant to be resolved in a special way, the value resolver will just pass you that string back as the result value.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg.
Creates a new value resolver instance.
The type of value that the new resolver should resolve.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
The value that the resolver should return if the string cannot be resolved to anything, or if there is an error in creating a resolver, or if resolution itself throws an exception.
Creates a new value resolver instance.
The type of value that the new resolver should resolve.
The property that is the context for the resolution to happen in.
The string that should be resolved to a value.
The value that the resolver should return if the string cannot be resolved to anything, or if there is an error in creating a resolver, or if resolution itself throws an exception.
The extra named args that this resolver has access to. Passing in a named arg that already exists will silently override the pre-existing named arg.
Gets a nicely formatted string that lists all the errors in the given set of value resolvers. The returned value is null if there are no errors.
Gets a nicely formatted string that lists all the errors in the given set of value resolvers. The returned value is null if there are no errors.
Draws error boxes for all errors in the given value resolvers, or does nothing if there are no errors. This is equivalent to calling DrawError() on all resolvers passed to this method.
Draws error boxes for all errors in the given value resolvers, or does nothing if there are no errors. This is equivalent to calling DrawError() on all resolvers passed to this method.
A ValueResolver resolves a string to a value of a given type, given an InspectorProperty instance to use as context. Call to get an instance of a ValueResolver.
Value resolvers are a globally extendable system that can be hooked into and modified or changed by creating and registering a .
See Odin's tutorials for details and examples of how to use ValueResolvers.
The delegate that does the actual value resolution. You should not call this manually, but instead call .
The type of value that this resolver instance is supposed to get. Always equal to typeof().
Gets a value from the value resolver.
The selection index at which to get the value, in the case of multi-selection. Defaults to 0.
The value that was gotten.
Gets a value from the value resolver in a weakly typed manner.
The selection index at which to get the value, in the case of multi-selection. Defaults to 0.
The value that was gotten.
This struct contains all of a ValueResolver's configurations and values it needs to function. For performance and simplicity reasons, this is a single very large struct that lives on a ValueResolver instance and is passed around by ref to anything that needs it.
The property that *provides* the context for the value resolution. This is the instance that was passed to the resolver when it was created. Note that this is different from , which is based on this value, but almost always isn't the same InspectorProperty instance.
The error message, if a valid value resolution wasn't found, or if creation of the value resolver failed because was invalid, or if value resolution was run but threw an exception. (In this last case, will be true.)
The named values that are available to the value resolver. Use this field only to get and set named values - once the ValueResolver has been created, new named values will have no effect.
This is the fallback value that the value resolver will return if there is an error or failed resolution for any reason.
Whether there is a fallback value. This boolean exists because then null is also a valid fallback value. This boolean will always be true if an overload is used that takes a fallback value parameter.
This will be true if is not null and the message was caused by an exception thrown by code invoked during an actual value resolution.
Whether exceptions thrown during value resolution should be logged to the console.
The type of value that the resolver is resolving.
The string that is resolved to get a value.
Whether the value resolver should sync ref parameters of invoked methods with named values. If this is true, then if a ref or out parameter value is changed during value resolution, the named value associated with that parameter will also be changed to the same value.
Whether this context has been resolved.
The type that is the parent of the value resolution, ie, the type that is the context. This is the same as .ValueEntry.TypeOfValue.
The property that *is* the context for the value resolution. This is not the instance that was passed to the resolver when it was created, but this value is based on that instance. This is the property that provides the actual context - for example, if is for a member of a type - or for an element in a collection contained by a member - this value will be the parent property for the type that contains that member. Only if is the tree's root property is the same as .
Gets the parent value which provides the context of the resolver.
The selection index of the parent value to get.
Sets the parent value which provides the context of the resolver.
The selection index of the parent value to set.
The value to set.
Adds the default named values of "property" and "value" to the context's named values.
This method is usually automatically invoked when a resolver is created, so there
is no need to invoke it manually.
The Odin Getting Started Window
Shows the window.
Initialize get called by OnEnable and by OnGUI after assembly reloads
which often happens when you recompile or enter and exit play mode.
Gets a value indicating whether the window should draw a scroll view.
Draws the Odin Editor Window.
Priority for and types.
Priority of the resolver.
Initializes a new instance of the class.
The higher the priority, the earlier it will be processed.
Draws an editor window with a menu tree.
public class OdinMenuEditorWindowExample : OdinMenuEditorWindow
{
[SerializeField, HideLabel]
private SomeData someData = new SomeData();
protected override OdinMenuTree BuildMenuTree()
{
OdinMenuTree tree = new OdinMenuTree(supportsMultiSelect: true)
{
{ "Home", this, EditorIcons.House }, // draws the someDataField in this case.
{ "Odin Settings", null, EditorIcons.SettingsCog },
{ "Odin Settings/Color Palettes", ColorPaletteManager.Instance, EditorIcons.EyeDropper },
{ "Odin Settings/AOT Generation", AOTGenerationConfig.Instance, EditorIcons.SmartPhone },
{ "Camera current", Camera.current },
{ "Some Class", this.someData }
};
tree.AddAllAssetsAtPath("More Odin Settings", SirenixAssetPaths.OdinEditorConfigsPath, typeof(ScriptableObject), true)
.AddThumbnailIcons();
tree.AddAssetAtPath("Odin Getting Started", SirenixAssetPaths.SirenixPluginPath + "Getting Started With Odin.asset");
var customMenuItem = new OdinMenuItem(tree, "Menu Style", tree.DefaultMenuStyle);
tree.MenuItems.Insert(2, customMenuItem);
tree.Add("Menu/Items/Are/Created/As/Needed", new GUIContent());
tree.Add("Menu/Items/Are/Created", new GUIContent("And can be overridden"));
// As you can see, Odin provides a few ways to quickly add editors / objects to your menu tree.
// The API also gives you full control over the selection, etc..
// Make sure to check out the API Documentation for OdinMenuEditorWindow, OdinMenuTree and OdinMenuItem for more information on what you can do!
return tree;
}
}
Called when the window is destroyed. Remember to call base.OnDestroy();
Builds the menu tree.
Gets or sets the width of the menu.
Gets a value indicating whether the menu is resizable.
Gets the menu tree.
Gets or sets a value indicating whether to draw the menu search bar.
Gets or sets the custom search function.
Forces the menu tree rebuild.
Tries to select the menu item with the specified object.
Draws the menu tree selection.
Draws the Odin Editor Window.
The method that draws the menu.
A menu item that represents one or more objects.
The default toggled state
Initializes a new instance of the class.
The Odin menu tree instance the menu item belongs to.
The name of the menu item.
The instance the value item represents.
Occurs right after the menu item is done drawing, and right before mouse input is handles so you can take control of that.
Occurs when the user has right-clicked the menu item.
Gets the child menu items.
The child menu items.
Gets the index location of the menu item.
Gets or sets a value indicating whether the menu item is visible.
Not that setting this to false will not hide its children as well. For that see use Toggled.
Gets or sets the icon that is used when the menu item is not selected.
Gets or sets the icon that is used when the menu item is selected.
Gets a value indicating whether this instance is selected.
Gets the menu tree instance.
Gets or sets the raw menu item name.
Gets or sets the search string used when searching for menu items.
Gets the next visual menu item.
Gets the parent menu item.
Gets the previous visual menu item.
Gets the drawn rect.
Gets the drawn label rect.
Gets or sets the style. If null is specified, then the menu trees DefaultMenuStyle is used.
Deselects this instance.
Selects the specified add to selection.
Gets the child menu items recursive in a DFS.
Whether to include it self in the collection.
Gets the child menu items recursive in a DFS.
Whether to include it self in the collection.
Whether to include the root.
Gets the full menu item path.
Gets the first object of the
Gets the object instances the menu item represents
Sets the object instance
Sets the object instances
Gets or sets the value the menu item represents.
Gets a nice menu item name. If the raw name value is null or a dollar sign, then the name is retrieved from the object itself via ToString().
Gets or sets a value indicating whether this is toggled / expanded. This value tries it best to be persistent.
Gets or sets the icon getter.
Draws this menu item followed by all of its child menu items
The indent level.
Draws the menu item with the specified indent level.
Override this to add custom GUI to the menu items.
This is called right after the menu item is done drawing, and right before mouse input is handles so you can take control of that.
Handles the mouse events.
The rect.
The triangle rect.
The style settings used by .
A nice trick to style your menu is to add the tree.DefaultMenuStyle to the tree itself,
and style it live. Once you are happy, you can hit the Copy CSharp Snippet button,
remove the style from the menu tree, and paste the style directly into your code.
Gets or sets the default selected style.
Gets or sets the selected label style.
The height of the menu item.
The global offset of the menu item content
The vertical offset of the menu item label
The number of pixels to indent per level indent level.
The size of the icon.
The size of the icon.
The transparency of icons when the menu item is not selected.
The padding between the icon and other content.
Whether to draw the a foldout triangle for menu items with children.
The size of the foldout triangle icon.
The padding between the foldout triangle icon and other content.
Whether or not to align the triangle left or right of the content.
If right, then the icon is pushed all the way to the right at a fixed position ignoring the indent level.
Whether to draw borders between menu items.
The horizontal border padding.
The border alpha.
The background color for when a menu item is selected.
The background color for when a menu item is selected.
The background color for when a menu item is selected.
The background color for when a menu item is selected.
Sets the height of the menu item.
Sets the global offset of the menu item content
Sets the number of pixels to indent per level indent level.
Sets the size of the icon.
Sets the size of the icon.
Sets the transparency of icons when the menu item is not selected.
Sets the padding between the icon and other content.
Sets whether to draw the a foldout triangle for menu items with children.
Sets the size of the foldout triangle icon.
Sets the padding between the foldout triangle icon and other content.
Sets whether or not to align the triangle left or right of the content.
If right, then the icon is pushed all the way to the right at a fixed position ignoring the indent level.
Sets whether to draw borders between menu items.
Sets the border alpha.
Sets the border alpha.
Sets the background color for when a menu item is selected.
Sets the background color for when a menu item is selected.
Creates and returns an instance of a menu style that makes it look like Unity's project window.
OdinMenuTree provides a tree of s, and helps with selection, inserting menu items into the tree, and can handle keyboard navigation for you.
OdinMenuTree tree = new OdinMenuTree(supportsMultiSelect: true)
{
{ "Home", this, EditorIcons.House },
{ "Odin Settings", null, EditorIcons.SettingsCog },
{ "Odin Settings/Color Palettes", ColorPaletteManager.Instance, EditorIcons.EyeDropper },
{ "Odin Settings/AOT Generation", AOTGenerationConfig.Instance, EditorIcons.SmartPhone },
{ "Camera current", Camera.current },
{ "Some Class", this.someData }
};
tree.AddAllAssetsAtPath("Some Menu Item", "Some Asset Path", typeof(ScriptableObject), true)
.AddThumbnailIcons();
tree.AddAssetAtPath("Some Second Menu Item", "SomeAssetPath/SomeAssetFile.asset");
var customMenuItem = new OdinMenuItem(tree, "Menu Style", tree.DefaultMenuStyle);
tree.MenuItems.Insert(2, customMenuItem);
tree.Add("Menu/Items/Are/Created/As/Needed", new GUIContent());
tree.Add("Menu/Items/Are/Created", new GUIContent("And can be overridden"));
OdinMenuTrees are typically used with s but is made to work perfectly fine on its own for other use cases.
OdinMenuItems can be inherited and and customized to fit your needs.
// Draw stuff
someTree.DrawMenuTree();
// Draw stuff
someTree.HandleKeybaordMenuNavigation();
Gets the currently active menu tree.
Gets the selection.
Gets the root menu items.
Gets the root menu item.
If true, all indent levels will be ignored, and all menu items with IsVisible == true will be drawn.
Adds a menu item with the specified object instance at the the specified path.
Adds a menu item with the specified object instance and icon at the the specified path.
Adds a menu item with the specified object instance and icon at the the specified path.
Adds a menu item with the specified object instance and icon at the the specified path.
Adds a collection of objects to the menu tree and returns all menu items created in random order.
Adds a collection of objects to the menu tree and returns all menu items created in random order.
Gets or sets the default menu item style from Config.DefaultStyle.
Gets or sets the default drawing configuration.
Initializes a new instance of the class.
Initializes a new instance of the class.
if set to true [supports multi select].
Initializes a new instance of the class.
if set to true [supports multi select].
The default menu item style.
Initializes a new instance of the class.
Scrolls to the specified menu item.
Enumerates the tree with a DFS.
if set to true then the invisible root menu item is included.
Enumerates the tree with a DFS.
The predicate.
if set to true then the invisible root menu item is included.
Enumerates the tree with a DFS.
Draws the menu tree recursively.
Marks the dirty. This will cause a tree.UpdateTree() in the beginning of the next Layout frame.
Draws the search toolbar.
Updates the menu tree. This method is usually called automatically when needed.
Handles the keyboard menu navigation. Call this at the end of your GUI scope, to prevent the menu tree from stealing input events from other text fields.
Returns true, if anything was changed via the keyboard.
Handles the keyboard menu navigation. Call this at the end of your GUI scope, to prevent the menu tree from stealing input events from other text fields.
Returns true, if anything was changed via the keyboard.
This class fixes a bug where Unity's Undo.RecordObject does not mark ScriptableObjects dirty when
a change is recorded for them. It does this by subscribing to the Undo.postprocessModifications
event, and marking all modified ScriptableObjects dirty manually.
The config used by OdinMenuTree to specify which features of the Menu Tree should be used when drawing.
Gets or sets the default menu item style.
The automatic scroll on selection changed. True by default.
Whether to draw the tree in a scrollable view. True by default.
Whether to handle keyboard navigation after it's done drawing. True by default.
Whether to draw a searchbar above the menu tree. True by default.
Whether to the menu items expanded state should be cached. True by default.
Whether to automatically set focus on the search bar when the tree is drawn for the first time. True by default.
The scroll-view position.
The search term.
The height of the search toolbar.
Gets or sets the search function. Null by default.
By default, the MenuTree.Selection is confirmed when menu items are double clicked,
Set this to false if you don't want that behaviour.
By default, the MenuTree.Selection is confirmed when menu items are double clicked,
Set this to false if you don't want that behaviour.
Class with utility methods for s and s.
OdinMenuTree tree = new OdinMenuTree();
tree.AddAllAssetsAtPath("Some Menu Item", "Some Asset Path", typeof(ScriptableObject), true)
.AddThumbnailIcons();
tree.AddAssetAtPath("Some Second Menu Item", "SomeAssetPath/SomeAssetFile.asset");
// etc...
Adds the menu item at the specified menu item path and populates the result list with all menu items created in order to add the menuItem at the specified path.
The tree instance.
The result list.
The menu item path.
The menu item.
Adds the menu item at specified menu item path, and returns all menu items created in order to add the menuItem at the specified path.
The tree.
The menu item path.
The menu item.
Returns all menu items created in order to add the menu item at the specified menu item path.
Gets the menu item at the specified path, returns null non was found.
Adds all asset instances from the specified path and type into a single at the specified menu item path, and returns all menu items created in order to add the menuItem at the specified path..
The tree.
The menu item path.
The asset folder path.
The type of objects.
Whether to search for assets in subdirectories as well.
Returns all menu items created in order to add the menu item at the specified menu item path.
Adds all assets at the specified path. Each asset found gets its own menu item inside the specified menu item path.
The tree.
The menu item path.
The asset folder path.
The type.
Whether to search for assets in subdirectories as well.
If true, sub-directories in the assetFolderPath will no longer get its own sub-menu item at the specified menu item path.
Returns all menu items created in order to add the menu item at the specified menu item path.
Adds all assets at the specified path. Each asset found gets its own menu item inside the specified menu item path.
The tree.
The menu item path.
The asset folder path.
Whether to search for assets in subdirectories as well.
If true, sub-directories in the assetFolderPath will no longer get its own sub-menu item at the specified menu item path.
Returns all menu items created in order to add the menu item at the specified menu item path.
Adds the asset at the specified menu item path and returns all menu items created in order to end up at the specified menu path.
The tree.
The menu item path.
The asset path.
Returns all menu items created in order to add the menu item at the specified menu item path.
Adds the asset at the specified menu item path and returns all menu items created in order to end up at the specified menu path.
The tree.
The menu item path.
The asset path.
The type.
Returns all menu items created in order to add the menu item at the specified menu item path.
Sorts the entire tree of menu items recursively by name with respects to numbers.
Sorts the collection of menu items recursively by name with respects to numbers. This is a stable sort, meaning that equivalently ordered items will remain in the same order as they start.
Sorts the collection of menu items recursively using a given custom comparison. This is a stable sort, meaning that equivalently ordered items will remain in the same order as they start.
Adds the specified object at the specified menu item path and returns all menu items created in order to end up at the specified menu path.
The tree.
The menu path.
The object instance.
Set this to true if you want Odin serialzied members such as dictionaries and generics to be shown as well.
Returns all menu items created in order to add the menu item at the specified menu item path.
Assigns the specified icon to all menu items in the collection with the specified ObjectInstanceType.
Assigns the specified icon to all menu items in the collection with the specified ObjectInstanceType.
Assigns the specified icon to all menu items in the collection.
Assigns the specified icon to all menu items in the collection.
Assigns the specified icon to the last menu item in the collection.
Assigns the specified icon to the last menu item in the collection.
Assigns the specified icon to the last menu item in the collection.
Assigns the specified icon to the last menu item in the collection.
Assigns the specified icon to all menu items in the collection.
Assigns the specified icon to all menu items in the collection.
Assigns the specified icon to all menu items in the collection.
Assigns the asset mini thumbnail as an icon to all menu items in the collection. If the menu items object is null then a Unity folder icon is assigned.
Assigns the asset mini thumbnail as an icon to all menu items in the collection. If the menu items object is null then a Unity folder icon is assigned.
Constants which describe the type of change that was made to the OdinMenuTrees's Selection
A menu item was removed.
A menu item was selected.
The selection was cleared.
Handles the selection of a Odin Menu Tree with support for multi selection.
Initializes a new instance of the class.
if set to true [supports multi select].
Occurs whenever the selection has changed.
Occurs whenever the selection has changed.
Usually occurs whenever the user hits return, or double click a menu item.
Gets the count.
Gets the first selected value, returns null if non is selected.
Gets all selected values.
Gets or sets a value indicating whether multi selection is supported.
Gets the at the specified index.
Adds a menu item to the selection. If the menu item is already selected, then the item is pushed to the bottom of the selection list.
If multi selection is off, then the previous selected menu item is removed first.
Adding a item to the selection triggers .
The item.
Clears the selection and triggers .
Determines whether an OdinMenuItem is selected.
Copies all the elements of the current array to the specified array starting at the specified destination array index.
Gets the enumerator.
Searches for the specified menu item and returns the index location.
Removes the specified menu item and triggers .
Removes the menu item at the specified index and triggers .
Triggers OnSelectionConfirmed.
Used in to associate name to a value in the GenericSelector.
The value.
The name.
Initializes a new instance of the struct.
If the
Opens a window which displays a list of all icons available from .
Opens a window which displays a list of all icons available from .
Builds the selection tree.
A feature-rich enum selector with support for flag enums.
KeyCode someEnumValue;
[OnInspectorGUI]
void OnInspectorGUI()
{
// Use the selector manually. See the documentation for OdinSelector for more information.
if (GUILayout.Button("Open Enum Selector"))
{
EnumSelector<KeyCode> selector = new EnumSelector<KeyCode>();
selector.SetSelection(this.someEnumValue);
selector.SelectionConfirmed += selection => this.someEnumValue = selection.FirstOrDefault();
selector.ShowInPopup(); // Returns the Odin Editor Window instance, in case you want to mess around with that as well.
}
// Draw an enum dropdown field which uses the EnumSelector popup:
this.someEnumValue = EnumSelector<KeyCode>.DrawEnumField(new GUIContent("My Label"), this.someEnumValue);
}
// All Odin Selectors can be rendered anywhere with Odin. This includes the EnumSelector.
EnumSelector<KeyCode> inlineSelector;
[ShowInInspector]
EnumSelector<KeyCode> InlineSelector
{
get { return this.inlineSelector ?? (this.inlineSelector = new EnumSelector<KeyCode>()); }
set { }
}
By default, the enum type will be drawn as the title for the selector. No title will be drawn if the string is null or empty.
Gets a value indicating whether this instance is flag enum.
Initializes a new instance of the class.
Populates the tree with all enum values.
When ShowInPopup is called, without a specified window width, this method gets called.
Here you can calculate and give a good default width for the popup.
The default implementation returns 0, which will let the popup window determine the width itself. This is usually a fixed value.
Gets the currently selected enum value.
Selects an enum.
Draws an enum selector field using the enum selector.
Draws an enum selector field using the enum selector.
Draws an enum selector field using the enum selector.
Draws an enum selector field using the enum selector.
In simple one-off use cases, making a custom OdinSelector might not be needed, as the GenericSelecor
can be populated with anything and customized a great deal.
SomeType someValue;
[OnInspectorGUI]
void OnInspectorGUI()
{
if (GUILayout.Button("Open Generic Selector Popup"))
{
List<SomeType> source = ...;
GenericSelector<SomeType> selector = new GenericSelector<SomeType>("Title", false, x => x.Path, source);
selector.SetSelection(this.someValue);
selector.SelectionTree.Config.DrawSearchToolbar = false;
selector.SelectionTree.DefaultMenuStyle.Height = 22;
selector.SelectionConfirmed += selection => this.someValue = selection.FirstOrDefault()
var window = selector.ShowInPopup();
window.OnEndGUI += () => { EditorGUILayout.HelpBox("A quick way of injecting custom GUI to the editor window popup instance.", MessageType.Info); };
window.OnClose += selector.SelectionTree.Selection.ConfirmSelection; // Confirm selection when window clses.
}
}
Gets or sets a value indicating whether [flattened tree].
Gets or sets a value indicating whether [checkbox toggle].
Initializes a new instance of the class.
Initializes a new instance of the class.
Initializes a new instance of the class.
Initializes a new instance of the class.
Initializes a new instance of the class.
Initializes a new instance of the class.
Initializes a new instance of the class.
Initializes a new instance of the class.
Initializes a new instance of the class.
Gets the title. No title will be drawn if the string is null or empty.
Draws the selection tree. This gets drawn using the OnInspectorGUI attribute.
Builds the selection tree.
OdinSelectors is an abstract base class that combines OdinMenuTrees and OdinEditorWindows to help making feature-rich selectors and popup selectors.
public class MySelector : OdinSelector<SomeType>
{
private readonly List<SomeType> source;
private readonly bool supportsMultiSelect;
public MySelector(List<SomeType> source, bool supportsMultiSelect)
{
this.source = source;
this.supportsMultiSelect = supportsMultiSelect;
}
protected override void BuildSelectionTree(OdinMenuTree tree)
{
tree.Config.DrawSearchToolbar = true;
tree.Selection.SupportsMultiSelect = this.supportsMultiSelect;
tree.Add("Defaults/None", null);
tree.Add("Defaults/A", new SomeType());
tree.Add("Defaults/B", new SomeType());
tree.AddRange(this.source, x => x.Path, x => x.SomeTexture);
}
[OnInspectorGUI]
private void DrawInfoAboutSelectedItem()
{
SomeType selected = this.GetCurrentSelection().FirstOrDefault();
if (selected != null)
{
GUILayout.Label("Name: " + selected.Name);
GUILayout.Label("Data: " + selected.Data);
}
}
}
Usage:
void OnGUI()
{
if (GUILayout.Button("Open My Selector"))
{
List<SomeType> source = this.GetListOfThingsToSelectFrom();
MySelector selector = new MySelector(source, false);
selector.SetSelection(this.someValue);
selector.SelectionCancelled += () => { }; // Occurs when the popup window is closed, and no slection was confirmed.
selector.SelectionChanged += col => { };
selector.SelectionConfirmed += col => this.someValue = col.FirstOrDefault();
selector.ShowInPopup(); // Returns the Odin Editor Window instance, in case you want to mess around with that as well.
}
}
// All Odin Selectors can be rendered anywhere with Odin.
[ShowInInspector]
MySelector inlineSelector;
If true, a confirm selection button will be drawn in the title-bar.
Enables the single click to select.
Occurs when the window is closed, and no slection was confirmed.
Occurs when the menuTrees selection is changed and IsValidSelection returns true.
Occurs when the menuTrees selection is confirmed and IsValidSelection returns true.
Gets the selection menu tree.
Gets the title. No title will be drawn if the string is null or empty.
Gets the current selection from the menu tree whether it's valid or not.
Determines whether the specified collection is a valid collection.
If false, the SlectionChanged and SelectionConfirm events will not be called.
By default, this returns true if the collection contains one or more items.
Sets the selection.
Sets the selection.
Opens up the selector instance in a popup at the specified rect position.
The width of the popup is determined by DefaultWindowWidth, and the height is automatically calculated.
Opens up the selector instance in a popup at the specified rect position.
Opens up the selector instance in a popup at the specified rect position.
The mouse position is used as the position for the window.
Opens up the selector instance in a popup at the specified position.
Opens up the selector instance in a popup at the specified position.
Opens up the selector instance in a popup at the specified rect position.
Opens up the selector instance in a popup at the specified position.
The width of the popup is determined by DefaultWindowWidth, and the height is automatically calculated.
Opens up the selector instance in a popup with the specified width and height.
The mouse position is used as the position for the window.
Builds the selection tree.
When ShowInPopup is called, without a specifed window width, this methods gets called.
Here you can calculate and give a good default width for the popup.
The default implementation returns 0, which will let the popup window determain the width itself. This is usually a fixed value.
Triggers the selection changed event, but only if the current selection is valid.
Draw the selecotr manually.
Draws the selection tree. This gets drawn using the OnInspectorGUI attribute.
Draws dropwdown field, that creates and binds the selector to the dropdown field.
Draws dropwdown field, that creates and binds the selector to the dropdown field.
Draws dropwdown field, that creates and binds the selector to the dropdown field.
Draws dropwdown field, that creates and binds the selector to the dropdown field.
A feature-rich type selector.
Type[] selectedTypes;
void OnGUI()
{
// Use the selector manually. See the documentation for OdinSelector for more information.
if (GUILayout.Button("Open My Selector"))
{
TypeSelector selector = new TypeSelector(customListOfTypes);
TypeSelector selector = new TypeSelector(AssemblyTypeFlags.CustomTypes, supportsMultiSelect: true);
selector.SetSelection(this.selectedTypes);
selector.SelectionConfirmed += selection => this.selectedTypes = selection.ToArray();
selector.ShowInPopup(); // Returns the Odin Editor Window instance, in case you want to mess around with that as well.
}
}
private static Type currentSelectedType;
private static IEnumerable<Type> currentSource;
private static Func<Rect, OdinSelector<Type>> createTypeSelector = (rect) =>
{
TypeSelector selector = new TypeSelector(currentSource, false);
selector.SetSelection(currentSelectedType);
selector.ShowInPopup(rect);
return selector;
};
public static Type DrawTypeSelectorDropdown(GUIContent label, Type selectedType, IEnumerable<Type> source)
{
currentSource = source;
currentSelectedType = selectedType;
var dropdownText = selectedType == null ? "None" : selectedType.GetNiceName();
var selected = TypeSelector.DrawSelectorDropdown(label, dropdownText, createTypeSelector);
if (selected != null && selected.Any())
{
selectedType = selected.FirstOrDefault();
}
return selectedType;
}
Builds the selection tree.
450
Sets the selected types.
Editor Only Mode Utility.
Gaither all necessary information about the editor only state.
Disables Editor Only Mode.
Enables editor only mode.
Checks to see whether Editor Only Mode is enabled.
Checks to see whether Odin Inspector is installed in Source Code mode.
Contains general configuration for all Odin drawers.
You can modify the configuration in the Odin Preferences window found in 'Tools -> Odin Inspector -> Preferences -> Drawers -> General',
or by locating the configuration file stored as a serialized object in the Sirenix folder under 'Odin Inspector/Config/Editor/GeneralDrawerConfig'.
Specify whether or not the script selector above components should be drawn.
Specify whether or not the warning for properties that do not support prefab modifications should be shown in the inspector.
Specify whether or not the warning for properties that do not support prefab modifications should be shown in the inspector.
Specifies the maximum depth to which a property can draw itself recursively before the system refuses to draw it any deeper.
If set to true, most foldouts throughout the inspector will be expanded by default.
If set to true, buttons will show the result values from invoking them in the inspector by default.
If set to true, type matching for things such as drawers will be precomputed in a separate thread based on a cache from the previously loaded AppDomain that is stored on disk in the Project's Temp folder, resulting in some overall speedups in some cases when doing first-time type matching. Requires a recompile/project reload before it takes any effect.
Specify the animation speed for most foldouts throughout the inspector.
Specify the shaking duration for most shaking animations throughout the inspector.
Specify the animation speed for
When true the component labels, for vector fields, will be hidden when the field is too narrow.
Specify how the Quaternion struct should be shown in the inspector.
Gets or sets a value indicating whether [use improved enum drop down].
Gets or sets a value indicating whether [use improved enum drop down].
Specify whether or not a list should hide the foldout triangle when the list is empty.
Specifies whether a list should hide the foldout triangle when the list is empty.
Specify whether or not lists should hide the paging buttons when the list is collapsed.
Specify whether or not lists should hide the paging buttons when there is only one page.
Specify the number of elements drawn per page.
Specify whether or not lists should be expanded or collapsed by default.
Specify whether or not to include a button which expands the list, showing all pages at once.
Specify whether or not lists should show item count.
Specify whether or not lists should show item count.
Specify the color of even list elements when in the dark skin.
Specify the color of odd list elements when in the dark skin.
Specify the color of even list elements when in the light skin.
Specify the color of odd list elements when in the light skin.
Gets or sets the default size of the preview object field.
Gets or sets the default alignment of the preview object field.
Gets or sets which types should be drawn by default by the preview object field.
Resets all settings to default.
Tell Odin which types should be drawn or should not be drawn by Odin.
You can modify which types should be drawn by Odin in the Preferences window found in 'Tools -> Odin Inspector -> Preferences -> Editor Types',
or by locating the configuration file stored as a serialized object in the Sirenix folder under 'Odin Inspector/Config/Editor/InspectorConfig'.
Whether Odin is enabled in the inspector or not.
InspectorDefaultEditors is a bitmask used to tell which types should have an Odin Editor generated.
The config which contains configuration data for which types Odin should draw in the inspector.
Updates Unity with the current Odin editor configuration.
InspectorDefaultEditors is a bitmask used to tell which types should have an Odin Editor generated.
Excludes all types.
UserTypes includes all custom user scripts that are not located in an editor or plugin folder.
PluginTypes includes all types located in the plugins folder and are not located in an editor folder.
UnityTypes includes all types depended on UnityEngine and from UnityEngine, except editor, plugin and user types.
OtherTypes include all other types that are not depended on UnityEngine or UnityEditor.
Contains configuration data for which types Odin should draw in the inspector.
Note that this class supports assigning arbitrary editor types to inspect any Unity object type. The Editor Types GUI in preferences simply does not, as of now, support assigning editors of any other type than . However, the API is open to further customization.
When an editor is generated for a type, a new editor type is added to the GeneratedOdinEditors assembly, which is derived from the assigned editor type - in most cases, .
You can check if an editor is compatible using .
.
.
The type binder that the uses to bind types to names, and names to types.
This is usually an instance of .
Resets the drawing configuration to the default values.
Gets a list of all drawn types that have entries in the drawing config.
Forces the config's internal drawer type to value type lookup cache to rebuild itself.
Clears the editor type entry for the given drawer, so it will be set to Unity's default.
The drawn type to clear the editor for.
drawnType is null
Assigns a given editor to draw a given type.
The drawn type to assign an editor type for.
The editor type to assign. When generating editors, a type derived from this editor will be created and set to draw the given drawn type.
drawnType
The type " + editorType.GetNiceName() + " is not a valid base editor for type " + drawnType.GetNiceName() + ". Check criteria using .
Determines whether an editor value has been assigned for a given drawn type.
The drawn type to check.
drawnType is null
Gets which editor type would draw the given type. If the type has not been assigned a custom editor type in the config, the default editor type is returned using .
The drawn type to get an editor type for.
The editor that would draw the given type.
drawnType is null
Gets the default editor that this type would have, if no custom editor was set for this type in particular. This is calculated using the value of .
The drawn type to get the default editor for.
The editor that would draw this type by default, or null, if there is no default Odin-defined editor for the drawn type.
drawnType is null
Checks whether the given editor can be assigned to draw any type using the class.
Type of the editor to check.
True if the editor is valid, otherwise false
Checks whether the given editor can be assigned to draw a given type using the class.
This method checks the attribute on the type for whether the given type is compatible.
Type of the editor to check.
Type of the drawn value to check. If this parameter is null, the drawn type is not checked for compatibility with the editor type; only the editor type itself is checked for validity.
True if the editor is valid, otherwise false
editorType
Gets the type that an editor draws, by extracting it from the editor's attribute, if it is declared.
This method returns null for abstract editor types, as those can never draw anything.
Type of the editor.
Whether the editor in question is also an editor for types derived from the given type.
editorType
A type that indicates that a drawer is missing.
Draws an instance, and contains methods getting all types that should be drawn by Odin.
Note that this class keeps a lot of static state, and is only intended to draw the instance of that exists in the singleton asset. If used to draw other instances, odd behaviour may occur.
.
.
Determines whether Odin is capable of creating a custom editor for a given type.
Gets an array of all assigned editor types, and the types they have to draw.
Draws the property.
Contains information about an editor type which is assigned to draw a certain type in the inspector.
This class uses the instance to bind types to names, and names to types.
.
.
.
A default, empty value.
The name of the type to be drawn.
The name of the editor type.
Initializes a new instance of the struct.
The drawn type.
drawnType is null
Initializes a new instance of the struct.
The drawn type.
The editor type.
drawnType is null
Determines whether the specified is equal to this instance.
The to compare with this instance.
true if the specified is equal to this instance; otherwise, false.
Returns a hash code for this instance.
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Determines whether the specified , is equal to this instance.
The to compare with this instance.
true if the specified is equal to this instance; otherwise, false.
Implements the operator ==.
The x.
The y.
The result of the operator.
Implements the operator !=.
The x.
The y.
The result of the operator.
Represents a weakly typed collection of values for a - one value per selected inspector target.
Whether the values have been changed since was last called.
Marks the value collection as being clean again. This is typically called at the end of the current GUI frame, during .
Marks the value collection as being dirty, regardless of any value changes.
Reverts the value collection to its origin values (found in ) from the last call, and marks the value collection as being clean again.
Force sets the value, ignoring whether it is editable or not.
Note that this will fail on list element value entries where is true on the parent value entry.
The selection index of the value.
The value to be set.
The original values of the value collection, such as they were immediately after the last call.
Represents a strongly typed collection of values for a - one value per selected inspector target.
Gets the value at the given selection index.
The number of values in the collection.
The original values of the value collection, such as they were immediately after the last call.
Force sets the value, ignoring whether it is editable or not.
Note that this will fail on list element value entries where is true on the parent value entry.
The selection index of the value.
The value to be set.
Represents an alias for a strongly typed collection of values for a - one value per selected inspector target.
This class ensures that polymorphism works in the inspector, and can be strongly typed in applicable cases.
The type of the aliased collection.
The polymorphic type of this collection, which is assignable to .
Initializes a new instance of the class.
The property.
The aliased collection.
Not yet documented.
Not yet documented.
aliasedCollection
Whether the values have been changed since was last called.
The number of values in the collection.
Gets a value indicating whether this instance is synchronized.
true if this instance is synchronized; otherwise, false.
Gets the synchronization root object.
The synchronization root object.
The original values of the (loosely typed) value collection, such as they were immediately after the last call.
The original values of the value collection, such as they were immediately after the last call.
Gets or sets the at the specified index.
The .
The index.
Gets an enumerator for the collection.
Marks the value collection as being clean again. This is typically called at the end of the current GUI frame, during .
Reverts the value collection to its origin values (found in ) from the last call, and marks the value collection as being clean again.
Determines whether the collection contains the specified value.
The value.
true if the collection contains the specified value; otherwise, false.
Gets the index of the given value, or -1 if the value was not found.
The value to get the index of.
The index of the given value, or -1 if the value was not found.
Copies the collection to an array.
The array to copy to.
The index to copy from.
Gets the weakly typed value at the given index.
The index of the value to get.
The weakly typed value at the given index
Sets the weakly typed value at the given index.
The index to set the value of.
The value to set.
Force sets the value, ignoring whether it is editable or not.
Note that this will fail on list element value entries where is true on the parent value entry.
The selection index of the value.
The value to be set.
Force sets the value, ignoring whether it is editable or not.
Note that this will fail on list element value entries where is true on the parent value entry.
The selection index of the value.
The value to be set.
Marks the value collection as being dirty, regardless of any value changes.
Not yet documented.
Not yet documented.
Not yet documented.
Not yet documented.
Not yet documented.
Represents the values of an , and contains utilities for querying the values' type and getting and setting them.
The number of parallel values this entry represents. This will always be exactly equal to the count of .
Whether this value entry is editable or not.
If this value entry has the override type , this is the path of the property it references.
The actual serialization backend for this value entry, possibly inherited from the serialization backend of the root property this entry is a child of.
Note that this is *not* always equal to .
The property whose values this value entry represents.
Provides access to the weakly typed values of this value entry.
Whether this value entry has been changed from its prefab counterpart.
Whether this value entry has had its list length changed from its prefab counterpart.
Whether this value entry has had its dictionary values changes from its prefab counterpart.
A weakly typed smart value that represents the first element of the value entry's value collection, but has "smart logic" for setting the value that detects relevant changes and applies them in parallel.
This lets you often just use the smart value instead of having to deal with the tedium of multiple parallel values.
The type from which this value entry comes. If this value entry represents a member value, this is the declaring type of the member. If the value entry represents a collection element, this is the type of the collection.
The most precise known contained type of the value entry. If polymorphism is in effect, this will be some type derived from .
The base type of the value entry. If this is value entry represents a member value, this is the type of the member. If the value entry represents a collection element, this is the element type of the collection.
The special state of the value entry.
Whether this value entry is an alias, or not. Value entry aliases are used to provide strongly typed value entries in the case of polymorphism.
The context container of this property.
Whether this type is marked as an atomic type using a .
An event that is invoked during , when any values have changed.
An event that is invoked during , when any child values have changed.
Updates the values contained in this value entry to the actual values in the target objects, and updates its state (override, type of value, etc.) accordingly.
Applies the changes made to this value entry to the target objects, and registers prefab modifications as necessary.
True if any changes were made, otherwise, false.
Checks whether the values in this value entry are equal to the values in another value entry.
Note, both value entries must have the same value type, and must represent values that are .NET value types.
Determines whether the value at the given selection index is different from the given prefab value, as is relevant for prefab modification checks.
If the value is a reference type, null and type difference is checked. If value is a value type, a comparer from is used.
This method is best ignored unless you know what you are doing.
The value to check differences against.
The selection index to compare against.
Represents the strongly typed values of an , and contains utilities for querying the values' type and getting and setting them.
Provides access to the strongly typed values of this value entry.
A strongly typed smart value that represents the first element of the value entry's value collection, but has "smart logic" for setting the value that detects relevant changes and applies them in parallel.
This lets you often just use the smart value instead of having to deal with the tedium of multiple parallel values.
Determines whether the value at the given selection index is different from the given prefab value, as is relevant for prefab modification checks.
If the value is a reference type, null and type difference is checked. If value is a value type, a comparer from is used.
This method is best ignored unless you know what you are doing.
The value to check differences against.
The selection index to compare against.
A polymorphic alias for a instance, used to implement strongly typed polymorphism in Odin.
The number of parallel values this entry represents. This will always be exactly equal to the count of .
Whether this value entry is editable or not.
If this value entry has the override type , this is the path of the property it references.
The actual serialization backend for this value entry, possibly inherited from the serialization backend of the root property this entry is a child of.
Note that this is *not* always equal to .
The property whose values this value entry represents.
Provides access to the weakly typed values of this value entry.
Whether this value entry has been changed from its prefab counterpart.
Whether this value entry has had its list length changed from its prefab counterpart.
Whether this value entry has had its dictionary values changes from its prefab counterpart.
A weakly typed smart value that represents the first element of the value entry's value collection, but has "smart logic" for setting the value that detects relevant changes and applies them in parallel.
This lets you often just use the smart value instead of having to deal with the tedium of multiple parallel values.
The type from which this value entry comes. If this value entry represents a member value, this is the declaring type of the member. If the value entry represents a collection element, this is the type of the collection.
The most precise known contained type of the value entry. If polymorphism is in effect, this will be some type derived from .
The base type of the value entry. If this is value entry represents a member value, this is the type of the member. If the value entry represents a collection element, this is the element type of the collection.
The special state of the value entry.
Whether this value entry is an alias, or not. Value entry aliases are used to provide strongly typed value entries in the case of polymorphism.
The context container of this property.
Whether this type is marked as an atomic type using a .
An event that is invoked during , when any values have changed.
An event that is invoked during , when any child values have changed.
Applies the changes made to this value entry to the target objects, and registers prefab modifications as necessary.
True if any changes were made, otherwise, false.
Updates the values contained in this value entry to the actual values in the target objects, and updates its state (override, type of value, etc.) accordingly.
Checks whether the values in this value entry are equal to the values in another value entry.
Note, both value entries must have the same value type, and must represent values that are .NET value types.
Sets the actual value of a value entry, for a given selection index.
Determines whether the value at the given selection index is different from the given prefab value, as is relevant for prefab modification checks.
If the value is a reference type, null and type difference is checked. If value is a value type, a comparer from is used.
This method is best ignored unless you know what you are doing.
The value to check differences against.
The selection index to compare against.
A polymorphic alias for a instance, used to implement strongly typed polymorphism in Odin.
Initializes a new instance of the class.
The value entry to alias.
valueEntry is null
Provides access to the strongly typed values of this value entry.
A strongly typed smart value that represents the first element of the value entry's value collection, but has "smart logic" for setting the value that detects relevant changes and applies them in parallel.
This lets you often just use the smart value instead of having to deal with the tedium of multiple parallel values.
A weakly typed smart value that represents the first element of the value entry's value collection, but has "smart logic" for setting the value that detects relevant changes and applies them in parallel.
This lets you often just use the smart value instead of having to deal with the tedium of multiple parallel values.
The number of parallel values this entry represents. This will always be exactly equal to the count of .
Whether this value entry is editable or not.
If this value entry has the override type , this is the path of the property it references.
The actual serialization backend for this value entry, possibly inherited from the serialization backend of the root property this entry is a child of.
Note that this is *not* always equal to .
The property whose values this value entry represents.
Provides access to the weakly typed values of this value entry.
Whether this value entry has been changed from its prefab counterpart.
Whether this value entry has had its list length changed from its prefab counterpart.
Whether this value entry has had its dictionary values changes from its prefab counterpart.
The type from which this value entry comes. If this value entry represents a member value, this is the declaring type of the member. If the value entry represents a collection element, this is the type of the collection.
The most precise known contained type of the value entry. If polymorphism is in effect, this will be some type derived from .
The base type of the value entry. If this is value entry represents a member value, this is the type of the member. If the value entry represents a collection element, this is the element type of the collection.
The special state of the value entry.
Whether this type is marked as an atomic type using a .
An event that is invoked during , when any values have changed.
An event that is invoked during , when any child values have changed.
Applies the changes made to this value entry to the target objects, and registers prefab modifications as necessary.
True if any changes were made, otherwise, false.
Updates the values contained in this value entry to the actual values in the target objects, and updates its state (override, type of value, etc.) accordingly.
Checks whether the values in this value entry are equal to the values in another value entry.
Note, both value entries must have the same value type, and must represent values that are .NET value types.
Sets the actual value of a value entry, for a given selection index.
Determines whether the value at the given selection index is different from the given prefab value, as is relevant for prefab modification checks.
If the value is a reference type, null and type difference is checked. If value is a value type, a comparer from is used.
This method is best ignored unless you know what you are doing.
The value to check differences against.
The selection index to compare against.
Determines whether the value at the given selection index is different from the given prefab value, as is relevant for prefab modification checks.
If the value is a reference type, null and type difference is checked. If value is a value type, a comparer from is used.
This method is best ignored unless you know what you are doing.
The value to check differences against.
The selection index to compare against.
Draws short properties marked with .
Not yet documented.
Draws int properties marked with .
Not yet documented.
Draws long properties marked with .
Not yet documented.
Draws float properties marked with .
Not yet documented.
Draws double properties marked with .
Not yet documented.
Draws decimal properties marked with .
Not yet documented.
Draws Vector2 properties marked with .
Not yet documented.
Draws Vector3 properties marked with .
Not yet documented.
Draws Vector4 properties marked with .
Not yet documented.
Draws properties marked with .
Draws the property.
Base class for creating editor windows using Odin.
public class SomeWindow : OdinEditorWindow
{
[MenuItem("My Game/Some Window")]
private static void OpenWindow()
{
GetWindow<SomeWindow>().Show();
}
[Button(ButtonSizes.Large)]
public void SomeButton() { }
[TableList]
public SomeType[] SomeTableData;
}
public class DrawSomeSingletonInAnEditorWindow : OdinEditorWindow
{
[MenuItem("My Game/Some Window")]
private static void OpenWindow()
{
GetWindow<DrawSomeSingletonInAnEditorWindow>().Show();
}
protected override object GetTarget()
{
return MySingleton.Instance;
}
}
private void InspectObjectInWindow()
{
OdinEditorWindow.InspectObject(someObject);
}
private void InspectObjectInDropDownWithAutoHeight()
{
var btnRect = GUIHelper.GetCurrentLayoutRect();
OdinEditorWindow.InspectObjectInDropDown(someObject, btnRect, btnRect.width);
}
private void InspectObjectInDropDown()
{
var btnRect = GUIHelper.GetCurrentLayoutRect();
OdinEditorWindow.InspectObjectInDropDown(someObject, btnRect, new Vector2(btnRect.width, 100));
}
private void InspectObjectInACenteredWindow()
{
var window = OdinEditorWindow.InspectObject(someObject);
window.position = GUIHelper.GetEditorWindowRect().AlignCenter(270, 200);
}
private void OtherStuffYouCanDo()
{
var window = OdinEditorWindow.InspectObject(this.someObject);
window.position = GUIHelper.GetEditorWindowRect().AlignCenter(270, 200);
window.titleContent = new GUIContent("Custom title", EditorIcons.RulerRect.Active);
window.OnClose += () => Debug.Log("Window Closed");
window.OnBeginGUI += () => GUILayout.Label("-----------");
window.OnEndGUI += () => GUILayout.Label("-----------");
}
Occurs when the window is closed.
Occurs at the beginning the OnGUI method.
Occurs at the end the OnGUI method.
Gets the label width to be used. Values between 0 and 1 are treated as percentages, and values above as pixels.
Gets or sets the window padding. x = left, y = right, z = top, w = bottom.
Gets a value indicating whether the window should draw a scroll view.
Gets a value indicating whether the window should draw a Unity editor preview, if possible.
Gets the default preview height for Unity editors.
Gets the target which which the window is supposed to draw. By default it simply returns the editor window instance itself. By default, this method is called by ().
Gets the targets to be drawn by the editor window. By default this simply yield returns the method.
At the start of each OnGUI event when in the Layout event, the GetTargets() method is called and cached into a list which you can access from here.
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
This particular overload uses a few frames to calculate the height of the content before showing the window with a height that matches its content.
Protip: You can subscribe to OnClose if you want to know when that occurs.
Measures the GUILayout content height and adjusts the window height accordingly.
Note that this feature becomes pointless if any layout group expands vertically.
The max height of the window.
When the window height expands below the screen bounds, it will move the window
upwards when needed, enabling this will move it back down when the window height is decreased.
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
Pops up an editor window for the given object in a drop-down window which closes when it loses its focus.
Protip: You can subscribe to OnClose if you want to know when that occurs.
Pops up an editor window for the given object.
Inspects the object using an existing OdinEditorWindow.
Creates an editor window instance for the specified object, without opening the window.
The Odin property tree drawn.
Draws the Odin Editor Window.
Calls DrawEditor(index) for each of the currently drawing targets.
Initialize get called by OnEnable and by OnGUI after assembly reloads
which often happens when you recompile or enter and exit play mode.
Called when the window is enabled. Remember to call base.OnEnable();
Draws the editor for the this.CurrentDrawingTargets[index].
Uses the method to draw a preview for the this.CurrentDrawingTargets[index].
Called when the window is destroyed. Remember to call base.OnDestroy();
Called before starting to draw all editors for the .
Called after all editors for the has been drawn.
See ISerializationCallbackReceiver.OnBeforeSerialize for documentation on how to use this method.
Implement this method to receive a callback after unity serialized your object.
Unity property drawer for abstract types.
Initializes the property drawer.
Draws the property.
Not yet documented.
Not yet documented.
Draws the default Odin inspector.
Draws the default Unity inspector.
Not yet documented.
Draws the property tree.
Called by Unity.
Called by Unity.
Unity property attribute drawer.
Initializes the drawer.
Draws the proprety.
Not yet documented.
Utility class for locating and sorting property drawers for the inspector.
See Odin manual section 'Drawers in Depth' for details on how the DrawerLocator determines which drawers to use.
Base class for all group drawers. Use this class to create your own custom group drawers. OdinGroupDrawer are used to group multiple properties together using an attribute.
Note that all box group attributes needs to inherit from the
Remember to provide your custom drawer with an
in order for it to be located by the .
Checkout the manual for more information.
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class MyBoxGroupAttribute : PropertyGroupAttribute
{
public MyBoxGroupAttribute(string group, float order = 0) : base(group, order)
{
}
}
// Remember to wrap your custom group drawer within a #if UNITY_EDITOR condition, or locate the file inside an Editor folder.
public class BoxGroupAttributeDrawer : OdinGroupDrawer<MyBoxGroupAttribute>
{
protected override void DrawPropertyGroupLayout(InspectorProperty property, MyBoxGroupAttribute attribute, GUIContent label)
{
GUILayout.BeginVertical("box");
for (int i = 0; i < property.Children.Count; i++)
{
InspectorUtilities.DrawProperty(property.Children[i]);
}
GUILayout.EndVertical();
}
}
// Usage:
public class MyComponent : MonoBehaviour
{
[MyBoxGroup("MyGroup")]
public int A;
[MyBoxGroup("MyGroup")]
public int B;
[MyBoxGroup("MyGroup")]
public int C;
}
Draws the property with GUILayout support.
The label. This can be null, so make sure your drawer supports that.
Base drawer to inherit from to draw methods.
DrawerPriority is used in conjunction with
to specify the priority of any given drawer. It consists of 3 components:
Super, Wrapper, Value, where Super is the most significant component,
and Standard is the least significant component.
Auto priority is defined by setting all of the components to zero.
If no is defined on a drawer, it will default to AutoPriority.
The standard priority. Mostly used by s.
The attribute priority. Mostly used by s.
The wrapper priority. Mostly used by drawers used to decorate properties.
The super priority. Mostly used by drawers that wants to wrap the entire property but don't draw the actual property.
These drawers typically don't draw the property itself, and calls CallNextDrawer.
The value priority. Mostly used by s and s.
The wrapper priority. Mostly used by drawers used to decorate properties.
The super priority. Mostly used by drawers that wants to wrap the entire property but don't draw the actual property.
These drawers typically don't draw the property itself, and calls CallNextDrawer.
Initializes a new instance of the struct.
The priority.
Initializes a new instance of the struct.
The super priority. Mostly used by drawers that wants to wrap the entire property but don't draw the actual property.
These drawers typically don't draw the property itself, and calls CallNextDrawer.
The wrapper priority. Mostly used by drawers used to decorate properties.
The value priority. Mostly used by s and s.
Implements the operator >.
The LHS.
The RHS.
The result of the operator.
Implements the operator <.
The LHS.
The RHS.
The result of the operator.
Implements the operator <=.
The LHS.
The RHS.
The result of the operator.
Implements the operator >=.
The LHS.
The RHS.
The result of the operator.
Implements the operator +.
The LHS.
The RHS.
The result of the operator.
Implements the operator -.
The LHS.
The RHS.
The result of the operator.
Implements the operator ==.
The LHS.
The RHS.
The result of the operator.
Implements the operator !=.
The LHS.
The RHS.
The result of the operator.
Gets the priority level.
Returns a that represents this instance.
A that represents this instance.
Returns a that represents this instance.
The format.
A that represents this instance.
Determines whether the specified , is equal to this instance.
The to compare with this instance.
true if the specified is equal to this instance; otherwise, false.
Returns a hash code for this instance.
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Equals the specified other.
The other.
Compares to.
The other.
DrawerPriority is used on inspector drawers and indicates the priority of the drawer.
Use this to make your custom drawer to come before or after other drawers, and potentially hide other drawers.
The following example shows how DrawerPriority could be apply to a value drawer.
[DrawerPriority(DrawerPriorityLevel.ValuePriority)]
public sealed class MyIntDrawer : InspectorValuePropertyDrawer<int>
{
// ...
}
The following example shows how DrawerPriority is used to mark a custom int drawer as a high priority drawer.
[DrawerPriority(1, 0, 0)]
public sealed class MySpecialIntDrawer : InspectorValuePropertyDrawer<int>
{
// ...
}
The priority of the drawer.
Indicates the priority of an inspector drawer.
Option for priority for the inspector drawer.
Indicates the priority of an inspector drawer.
The super priority. Mostly used by drawers that wants to wrap the entire property but don't draw the actual property.
These drawers typically don't draw the property itself, and calls CallNextDrawer.
The wrapper priority. Mostly used by drawers used to decorate properties.
The value priority. Mostly used by s and s.
DrawerPriorityLevel is used in conjunction with .
Auto priority is defined by setting all of the components to zero.
If no is defined on a drawer, it will default to AutoPriority.
The value priority. Mostly used by s.
The attribute priority. Mostly used by s.
The wrapper priority. Mostly used by drawers used to decorate properties.
The super priority. Mostly used by drawers that wants to wrap the entire property but don't draw the actual property.
These drawers typically don't draw the property itself, and calls CallNextDrawer.
Base class for emitted MonoBehaviour-derived types that have been created by the .
The field that backs the value of this MonoBehaviour.
Sets the value contained in this scriptable object.
Gets the value contained in this scriptable object.
Strongly typed base class for emitted MonoBehaviour-derived types that have been created by the .
Sets the value contained in this scriptable object.
Gets the value contained in this scriptable object.
Sets the value contained in this scriptable object.
Gets the value contained in this scriptable object.
Base class for emitted ScriptableObject-derived types that have been created by the .
The field that backs the value of this scriptable object.
Sets the value contained in this scriptable object.
Gets the value contained in this scriptable object.
Strongly typed base class for emitted scriptable object types that have been created by the .
Sets the value contained in this scriptable object.
Gets the value contained in this scriptable object.
Sets the value contained in this scriptable object.
Gets the value contained in this scriptable object.
This class fixes Unity's about window, by invoking "UnityEditor.VisualStudioIntegration.UnityVSSupport.GetAboutWindowLabel" before any dynamic assemblies have been defined.
This is because dynamic assemblies in the current AppDomain break that method, and Unity's about window depends on it.
If you mark any of Unity's assemblies with the [AssemblyVersion] attribute to get a rolling assembly
version that changes sometimes (or all the time), Odin's hardcoded assembly references to user types
will break.
To fix this case, and all other cases of references to wrongly versioned Unity types not being resolved,
we overload the app domain's type resolution and resolve Unity user assemblies properly regardless of
version.
Specifies hows any given drawer should drawer the property.
Changing this behavior, also changes which methods should be overridden in the drawer.
GUILayout enabled the use of GUILayout, EditorGUILayout and
Draws the property using Unity's GUI, and EditorGUI.
Base class for attribute drawers. Use this class to create your own custom attribute drawers that will work for all types.
Alternatively you can derive from if you want to only support specific types.
Odin supports the use of GUILayout and takes care of undo for you. It also takes care of multi-selection
in many simple cases. Check the manual for more information on handling multi-selection.
Also note that Odin does not require that your custom attribute inherits from Unity's PropertyAttribute.
The attribute that this drawer should be applied to.
Checkout the manual for more information.
Example using the .
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
public class CustomRangeAttribute : System.Attribute
{
public float Min;
public float Max;
public CustomRangeAttribute(float min, float max)
{
this.Min = min;
this.Max = max;
}
}
// Remember to wrap your custom attribute drawer within a #if UNITY_EDITOR condition, or locate the file inside an Editor folder.
public sealed class CustomRangeAttributeDrawer : OdinAttributeDrawer<CustomRangeAttribute, float>
{
protected override void DrawPropertyLayout(GUIContent label)
{
this.ValueEntry.SmartValue = EditorGUILayout.Slider(label, this.ValueEntry.SmartValue, this.Attribute.Min, this.Attribute.Max);
}
}
// Usage:
public class MyComponent : MonoBehaviour
{
[CustomRangeAttribute(0, 1)]
public float MyFloat;
}
Example using the .
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
public class GUITintColorAttribute : System.Attribute
{
public Color Color;
public GUITintColorAttribute(float r, float g, float b, float a = 1)
{
this.Color = new Color(r, g, b, a);
}
}
// Remember to wrap your custom attribute drawer within a #if UNITY_EDITOR condition, or locate the file inside an Editor folder.
public sealed class GUITintColorAttributeDrawer : OdinAttributeDrawer<GUITintColorAttribute>
{
protected override void DrawPropertyLayout(GUIContent label)
{
Color prevColor = GUI.color;
GUI.color *= this.Attribute.Color;
this.CallNextDrawer(label);
GUI.color = prevColor;
}
}
// Usage:
public class MyComponent : MonoBehaviour
{
[GUITintColor(0, 1, 0)]
public float MyFloat;
}
Odin uses multiple drawers to draw any given property, and the order in which these drawers are
called are defined using the .
Your custom drawer injects itself into this chain of drawers based on its .
If no is defined, a priority is generated automatically based on the type of the drawer.
Each drawer can ether choose to draw the property or not, or pass on the responsibility to the
next drawer by calling CallNextDrawer(), as the f attribute does in the example above.
This means that there is no guarantee that your drawer will be called, sins other drawers
could have a higher priority than yours and choose not to call CallNextDrawer().
Note that Odin's has full support for generic class constraints,
and if that is not enough, you can also add additional type constraints by overriding CanDrawTypeFilter
Also note that all custom property drawers needs to handle cases where the label provided by the DrawPropertyLayout is null,
otherwise exceptions will be thrown when in cases where the label is hidden. For instance when [HideLabel] is used, or the property is drawn within a list where labels are also not shown.
[DrawerPriority(DrawerPriorityLevel.AttributePriority)]
public sealed class MyCustomAttributeDrawer<T> : OdinAttributeDrawer<MyCustomAttribute, T> where T : class
{
public override bool CanDrawTypeFilter(Type type)
{
return type != typeof(string);
}
protected override void DrawPropertyLayout(GUIContent label)
{
// Draw property here.
}
}
Gets the attribute that the OdinAttributeDrawer draws for.
Tells whether or not multiple attributes are allowed.
Draws the property with the given label.
Override this to implement your custom OdinAttributeDrawer.
Optional label for the property.
Tests if the drawer can draw for the specified property.
The property to test.
true if the drawer can drawn the property. Otherwise false.
Tests if the attribute drawer can draw for the specified property.
The property to test.
true if the drawer can drawn the property. Otherwise false.
Base class for all type specific attribute drawers. For non-type specific attribute drawers see .
Odin supports the use of GUILayout and takes care of undo for you. It also takes care of multi-selection
in many simple cases. Checkout the manual for more information on handling multi-selection.
Also note that Odin does not require that your custom attribute inherits from Unity's PropertyAttribute.
The attribute that this drawer should be applied to.
The type of the value the drawer should be drawing. Note that Odin's has full support for generic constraints.
Checkout the manual for more information.
Example using the .
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
public class CustomRangeAttribute : System.Attribute
{
public float Min;
public float Max;
public CustomRangeAttribute(float min, float max)
{
this.Min = min;
this.Max = max;
}
}
// Remember to wrap your custom attribute drawer within a #if UNITY_EDITOR condition, or locate the file inside an Editor folder.
public sealed class CustomRangeAttributeDrawer : OdinAttributeDrawer<CustomRangeAttribute, float>
{
protected override void DrawPropertyLayout(GUIContent label)
{
this.ValueEntry.SmartValue = EditorGUILayout.Slider(label, this.ValueEntry.SmartValue, this.Attribute.Min, this.Attribute.Max);
}
}
// Usage:
public class MyComponent : MonoBehaviour
{
[CustomRangeAttribute(0, 1)]
public float MyFloat;
}
Example using the .
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
public class GUITintColorAttribute : System.Attribute
{
public Color Color;
public GUITintColorAttribute(float r, float g, float b, float a = 1)
{
this.Color = new Color(r, g, b, a);
}
}
// Remember to wrap your custom attribute drawer within a #if UNITY_EDITOR condition, or locate the file inside an Editor folder.
public sealed class GUITintColorAttributeDrawer : OdinAttributeDrawer<GUITintColorAttribute>
{
protected override void DrawPropertyLayout(GUIContent label)
{
Color prevColor = GUI.color;
GUI.color *= this.Attribute.Color;
this.CallNextDrawer(label);
GUI.color = prevColor;
}
}
// Usage:
public class MyComponent : MonoBehaviour
{
[GUITintColor(0, 1, 0)]
public float MyFloat;
}
Odin uses multiple drawers to draw any given property, and the order in which these drawers are
called is defined using the .
Your custom drawer injects itself into this chain of drawers based on its .
If no is defined, a priority is generated automatically based on the type of the drawer.
Each drawer can ether choose to draw the property or not, or pass on the responsibility to the
next drawer by calling CallNextDrawer(), as the GUITintColor attribute does in the example above.
This means that there is no guarantee that your drawer will be called, since other drawers
could have a higher priority than yours and choose not to call CallNextDrawer().
Note that Odin's has full support for generic class constraints,
and if that is not enough, you can also add additional type constraints by overriding CanDrawTypeFilter
Also note that all custom property drawers needs to handle cases where the label provided by the DrawPropertyLayout is null,
otherwise exceptions will be thrown when in cases where the label is hidden. For instance when [HideLabel] is used, or the property is drawn within a list where labels are also not shown.
[DrawerPriority(DrawerPriorityLevel.AttributePriority)]
public class MyCustomAttributeDrawer<T> : OdinAttributeDrawer<MyCustomAttribute, T> where T : class
{
public override bool CanDrawTypeFilter(Type type)
{
return type != typeof(string);
}
protected override void DrawPropertyLayout(GUIContent label)
{
// Draw property here.
}
}
Gets the strongly typed ValueEntry of the OdinAttributeDrawer's property.
Draws the property with the given label.
Override this to implement your custom OdinAttributeDrawer.
Optional label for the property.
Tests if the drawer can draw for the specified property.
The property to test.
true if the drawer can drawn the property. Otherwise false.
Tests if the attribute drawer can draw for the specified property.
The property to test.
true if the drawer can drawn the property. Otherwise false.
Some drawers don't want to have its GUI disabled, even if the property is read-only or a ReadOnly attribute is defined on the property.
Use this attribute on any drawer to force GUI being enabled in these cases.
[AllowGUIEnabledForReadonly]
public sealed class SomeDrawerDrawer<T> : OdinValueDrawer<T> where T : class
{
}
Base class for all Odin drawers. In order to create your own custom drawers you need to derive from one of the following drawers:
Remember to provide your custom drawer with an in order for it to be located by the .
Drawers require a context, and are instantiated automatically by the .
Odin supports the use of GUILayout and takes care of undo for you. It also takes care of multi-selection in many simple cases. Checkout the manual for more information.
If true then this drawer will be skipped in the draw chain. Otherwise the drawer will be called as normal in the draw chain.
Gets a value indicating if the drawer has been initialized yet.
Gets the property this drawer draws for.
Override this method in order to define custom type constraints to specify whether or not a type should be drawn by the drawer.
Note that Odin's has full support for generic class constraints, so most often you can get away with not overriding CanDrawTypeFilter.
The type.
Returns true by default, unless overridden.
Initializes the drawer instance.
Initializes the drawer instance. Override this to implement your own initialization logic.
Draws the property with a custom label.
The label. Null is allow if you wish no label should be drawn.
Draws the property with GUILayout support.
The label. This can be null, so make sure your drawer supports that.
Calls the next drawer in the draw chain.
The label to pass on to the next drawer.
Gets a value indicating if the drawer can draw for the specified property.
Override this to implement a custom property filter for your drawer.
The property to test.
true if the drawer can draw for the property. Otherwise false.
Provides a variety of miscellaneous utilities widely used in the inspector.
Converts an Odin property path to a deep reflection path.
Converts an Odin property path (without groups included) into a Unity property path.
Prepares a property tree for drawing, and handles management of undo, as well as marking scenes and drawn assets dirty.
The tree to be drawn.
Whether to register undo commands for the changes made to the tree. This can only be set to true if the tree has a to represent.
tree is null
Ends drawing a property tree, and handles management of undo, as well as marking scenes and drawn assets dirty.
The tree.
Draws all properties in a given property tree; must be wrapped by a and .
The tree to be drawn.
Draws a property in the inspector using a given label.
Odin property system exception.
Initializes a new instance of OdinPropertyException.
The message for the exception.
An inner exception.
Base class for all value drawers. Use this class to create your own custom drawers for any specific type.
Remember to provide your custom drawer with an
in order for it to be located by the .
Odin supports the use of GUILayout and takes care of undo for you. It also takes care of multi-selection
in many simple cases. Checkout the manual for more information on handling multi-selection.
Checkout the manual for more information.
public class MyCustomBaseType
{
}
public class MyCustomType : MyCustomBaseType
{
}
// Remember to wrap your custom attribute drawer within a #if UNITY_EDITOR condition, or locate the file inside an Editor folder.
public sealed class MyCustomBaseTypeDrawer<T> : OdinValueDrawer<T> where T : MyCustomBaseType
{
protected override void DrawPropertyLayout(IPropertyValueEntry<T> entry, GUIContent label)
{
T value = entry.SmartValue;
// Draw your custom drawer here using GUILayout and EditorGUILAyout.
}
}
// Usage:
// Both values will be drawn using the MyCustomBaseTypeDrawer
public class MyComponent : SerializedMonoBehaviour
{
public MyCustomBaseType A;
public MyCustomType B;
}
Odin uses multiple drawers to draw any given property, and the order in which these drawers are
called are defined using the .
Your custom drawer injects itself into this chain of drawers based on its .
If no is defined, a priority is generated automatically based on the type of the drawer.
Each drawer can ether choose to draw the property or not, or pass on the responsibility to the
next drawer by calling CallNextDrawer(). An example of this is provided in the documentation for .
This means that there is no guarantee that your drawer will be called, sins other drawers
could have a higher priority than yours and choose not to call CallNextDrawer().
To avoid this, you can tell Odin, that your drawer is a PrependDecorator or an AppendDecorator drawer (see ) as shown in the example shows below.
Prepend and append decorators are always drawn and are also ordered by the .
Note that Odin's have full support for generic class constraints,
and if that is not enough, you can also add additional type constraints by overriding CanDrawTypeFilter(Type type).
Also note that all custom property drawers needs to handle cases where the label provided by the DrawPropertyLayout is null,
otherwise exceptions will be thrown when in cases where the label is hidden. For instance when [HideLabel] is used, or the property is drawn within a list where labels are also not shown.
// [OdinDrawer(OdinDrawerBehaviour.DrawProperty)] // default
// [OdinDrawer(OdinDrawerBehaviour.AppendDecorator)]
[OdinDrawer(OdinDrawerBehaviour.PrependDecorator)]
[DrawerPriority(DrawerPriorityLevel.AttributePriority)]
public sealed class MyCustomTypeDrawer<T> : OdinValueDrawer<T> where T : MyCustomType
{
public override bool CanDrawTypeFilter(Type type)
{
return type != typeof(SomeType);
}
protected override void DrawPropertyLayout(IPropertyValueEntry<T> entry, GUIContent label)
{
T value = entry.SmartValue;
// Draw property here.
}
}
The value entry of the property.
Draws the property with GUILayout support.
The label. This can be null, so make sure your drawer supports that.
Gets a value indicating if the drawer can draw for the specified property.
The property to test.
true if the drawer can draw for the property. Otherwise false.
Gets a value indicating if the drawer can draw for the specified property.
Override this to implement a custom property filter for your drawer.
The property to test.
true if the drawer can draw for the property. Otherwise false.
Custom types used by the can choose to implement the ITemporaryContext
interface in order to be notified when the context gets reset.
Called by when the context gets reset.
Used by all InspectorProperty to tell Odin how to set or get a value on any given property.
Whether the value is readonly.
Gets the type of the owner.
Gets the type of the value.
Sets the weakly typed value on a given weakly typed owner.
The owner.
The value.
Gets the value from a given weakly typed owner.
The weakly typed owner.
The found value.
Used by all to tell Odin how to set or get a value on any given property.
Sets the value on a given owner.
The owner.
The value.
Gets the value from a given owner.
The owner.
When creating custom property drawers with or etc,
an OdinDrawerAttribute must be defined on the custom drawer class itself in order to specify that the drawer is meant to be included in the inspector.
If no OdinDrawerAttribute is defined, the will ignore your drawer.
Checkout the manual for more information.
// Specify that this drawer must be included in the inspector; without this, it will not be drawn
public class MyCustomTypeDrawer<T> : OdinValueDrawer<T> where T : MyCustomBaseType
{
protected override void DrawPropertyLayout(IPropertyValueEntry<T> entry, GUIContent label)
{
T value = entry.SmartValue;
// Draw property here.
// Optionally, call the next drawer in line.
this.CallNextDrawer(entry, label);
}
}
Initializes a new instance of the class.
Property drawer for primitive composite properties.
Draws the property.
Draws the property field.
Represents the children of an .
The that this instance handles children for.
Gets a child by index. This is an alias for .
The index of the child to get.
The child at the given index.
Gets a child by name. This is an alias for .
The name of the child to get.
The child, if a child was found; otherwise, null.
Gets a child by name. This is an alias for .
The name of the child to get.
The child, if a child was found; otherwise, null.
Initializes a new instance of the class.
The property to handle children for.
property is null
The number of children on the property.
Updates this instance of .
Gets a child by name.
The name of the child to get.
The child, if a child was found; otherwise, null.
name
Gets a child by name.
The name of the child to get.
The child, if a child was found; otherwise, null.
name
Gets a child by index.
The index of the child to get.
The child at the given index.
The given index was out of range.
Gets the path of the child at a given index.
The index to get the path of.
The path of the child at the given index.
The given index was out of range.
Returns an IEnumerable that recursively yields all children of the property, depth first.
Gets the property's already created children. If the child count is less than or equal to 10000, children are returned in order. If the count is larger than 10000, they are returned in no particular order.
Gets the enumerator.
Gets the enumerator.
Represents a weakly typed collection of values for a - one value per selected inspector target.
The property whose values are represented.
Initializes a new instance of the class.
The property to represent.
property is null
Whether the values have been changed since was last called.
The number of values in the collection.
Gets a value indicating whether this instance is synchronized.
true if this instance is synchronized; otherwise, false.
Gets the synchronization root object.
The synchronization root object.
The original values of the (loosely typed) value collection, such as they were immediately after the last call.
Gets or sets the weakly typed at the specified index.
The value.
The index to set.
Gets an enumerator for the collection.
Marks the value collection as being clean again. This is typically called at the end of the current GUI frame, during .
Reverts the value collection to its origin values (found in ) from the last call, and marks the value collection as being clean again.
Determines whether the collection contains the specified value.
The value.
true if the collection contains the specified value; otherwise, false.
Copies the collection to an array.
The array to copy to.
The index to copy from.
Gets the index of the given value, or -1 if the value was not found.
The value to get the index of.
The index of the given value, or -1 if the value was not found.
Gets the weakly typed value at the given index.
The index of the value to get.
The weakly typed value at the given index
Sets the weakly typed value at the given index.
The index to set the value of.
The value to set.
Force sets the value, ignoring whether it is editable or not.
Note that this will fail on list element value entries where is true on the parent value entry.
The selection index of the value.
The value to be set.
Marks the value collection as being dirty, regardless of any value changes.
Represents a strongly typed collection of values for a - one value per selected inspector target.
The element type of the collection.
Initializes a new instance of the class.
The property.
The internal array.
The original array.
The internal atom array.
The original atom array.
Whether the values have been changed since was last called.
The number of values in the collection.
Gets a value indicating whether this instance is synchronized.
true if this instance is synchronized; otherwise, false.
Gets the synchronization root object.
The synchronization root object.
The original values of the (loosely typed) value collection, such as they were immediately after the last call.
Gets or sets the at the specified index.
The .
The index.
Gets an enumerator for the collection.
Marks the value collection as being clean again. This is typically called at the end of the current GUI frame, during .
Reverts the value collection to its origin values (found in ) from the last call, and marks the value collection as being clean again.
Copies the collection to an array.
The array to copy to.
The index to copy from.
Gets the weakly typed value at the given index.
The index of the value to get.
The weakly typed value at the given index
Sets the weakly typed value at the given index.
The index to set the value of.
The value to set.
Determines whether the collection contains the specified value.
The value.
true if the collection contains the specified value; otherwise, false.
Gets the index of the given value, or -1 if the value was not found.
The value to get the index of.
The index of the given value, or -1 if the value was not found.
Force sets the value, ignoring whether it is editable or not.
Note that this will fail on list element value entries where is true on the parent value entry.
The selection index of the value.
The value to be set.
Force sets the value, ignoring whether it is editable or not.
Note that this will fail on list element value entries where is true on the parent value entry.
The selection index of the value.
The value to be set.
Marks the value collection as being dirty, regardless of any value changes.
A contextual value attached to an , mapped to a key, contained in a .
The contained value.
Creates a new PropertyContext.
Performs an explicit conversion from to .
The context.
The result of the conversion.
Returns a that represents this instance, of the format ": Value.ToString()".
A that represents this instance.
Contains a context for an , which offers the ability to address persistent values by key across several editor GUI frames.
Use this in drawers to store contextual editor-only values such as the state of a foldout.
Initializes a new instance of the class.
The property.
property
Gets a global context value for a given key, using a given delegate to generate a default value if the context doesn't already exist.
Global contexts are not associated with any one specific drawer, and so are shared across all drawers for this property.
The type of the context value to get.
The key of the context value to get.
A delegate for generating a default value.
The found context.
Gets a global context value for a given key, using a given default value if the context doesn't already exist.
Global contexts are not associated with any one specific drawer, and so are shared across all drawers for this property.
The type of the context value to get.
The key of the context value to get.
The default value to set if the context value doesn't exist yet.
The found context.
Gets a global context value for a given key, and creates a new instance of as a default value if the context doesn't already exist.
Global contexts are not associated with any one specific drawer, and so are shared across all drawers for this property.
The type of the context value to get.
The key of the context value to get.
The found context.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Local property contexts are obsolete. Use local drawer fields instead.
Gets a object and creates a object for it.
The type of the value of the context.
The instance of the drawer.
The key for the context.
The default value for the context.
Gets a object and creates a object for it.
Returns true when the is first created. Otherwise false.
The type of the value of the context.
The instance of the drawer.
The key for the context.
The object.
Returns true when the is first created. Otherwise false.
Swaps context values with a given .
The context to swap with.
An can implement this interface to indicate that it defines right-click context menu items for properties that it draws.
Method that is invoked when a user has right-clicked a property, and the context menu is being built. The method is invoked in order of drawer priority.
The property that has been right-clicked on.
The generic menu instance that is being built. Add items to this.
A polymorphic alias for getting and setting the values of an .
The type of the owner.
The type of the value.
The type of the property owner.
The type of the property value.
Gets the type of the owner.
Gets the type of the value.
Whether the value is readonly.
Initializes a new instance of the class.
The information.
info
Gets the value from a given weakly typed owner.
The weakly typed owner.
The found value.
Gets the value from a given owner.
The owner.
owner is null
Sets the weakly typed value on a given weakly typed owner.
The owner.
The value.
Sets the value on a given owner.
The owner.
The value.
Contains meta-data information about a property in the inspector, that can be used to create an actual property instance.
The name of the property.
Gets a value indicating whether this InspectorPropertyInfo has any backing members.
Gets a value indicating whether this InspectorPropertyInfo has only a single backing member.
The member info of the property. If the property has many member infos, such as if it is a group property, the first member info of is returned.
Indicates which type of property it is.
The serialization backend for this property.
The type on which this property is declared.
The base type of the value which this property represents. If there is no value, this will be null.
Whether this property is editable or not.
All member infos of the property. There will only be more than one member if it is an .
The order value of this property. Properties are (by convention) ordered by ascending order, IE, lower order values are shown first in the inspector. The final actual ordering of properties is decided upon by the property resolver.
The attributes associated with this property.
Whether this property only exists as a Unity , and has no associated managed member to represent it.
This case requires some special one-off custom behaviour in a few places.
Returns a that represents this instance.
A that represents this instance.
Gets the first attribute of a given type on this property.
Gets the first attribute of a given type on this property, which is not contained in a given hashset.
The attributes to exclude.
Gets all attributes of a given type on the property.
The s of all the individual properties in this group.
Gets the property's method delegate, if there is one. Note that this is null if a method property is backed by an actual method member.
Represents a property in the inspector, and provides the hub for all functionality related to that property.
Gets the property which is the ultimate root of this property's serialization.
The name of the property.
The nice name of the property, usually as converted by .
The cached label of the property, usually containing .
The full Odin path of the property. To get the Unity property path, see .
The child index of this property.
Gets the resolver for this property's children.
The current recursive draw depth, incremented for each time that the property has caused itself to be drawn recursively.
Note that this is the current recursion level, not the total amount of recursions so far this frame.
The amount of times that the property has been drawn so far this frame.
How deep in the drawer chain the property currently is, in the current drawing session as determined by .
Whether this property supports having prefab modifications applied or not.
Gets an immutable list of the components attached to the property.
Gets an immutable list of processed attributes for the property.
Gets an array of the state updaters of the property. Don't change the contents of this array!
The value entry that represents the base value of this property.
The value entry that represents the strongly typed value of the property; this is possibly an alias entry in case of polymorphism.
The parent of the property. If null, this property is a root-level property in the .
The of this property.
The that this property exists in.
The children of this property.
The context container of this property.
The last rect that this property was drawn within.
The type on which this property is declared. This is the same as .
The parent values of this property, by selection index; this represents the values that 'own' this property, on which it is declared.
The full Unity property path of this property; note that this is merely a converted version of , and not necessarily a path to an actual Unity property.
In the case of Odin-serialized data, for example, no Unity properties will exist at this path.
The full path of this property as used by deep reflection, containing all the necessary information to find this property through reflection only. This is used as the path for prefab modifications.
The full path of this property as used by prefab modifications and the deep reflection system, containing all the necessary information to find this property through reflection only.
The PropertyState of the property at the current draw count index.
Gets the component of a given type on the property, or null if the property does not have a component of the given type.
Marks the property's serialization root values dirty if they are derived from UnityEngine.Object.
Records the property's serialization root for undo to prepare for undoable changes, with a custom string that includes the property path and Unity object name. If a message is specified, it is included in the custom undo string.
Gets the first attribute of a given type on this property.
Gets the first attribute of a given type on this property, which is not contained in a given hashset.
The attributes to exclude.
Gets all attributes of a given type on the property.
Returns a that represents this instance.
A that represents this instance.
Draws this property in the inspector.
Draws this property in the inspector with a given default label. This default label may be overridden by attributes on the drawn property.
Push a draw session. This is used by and .
Increments the current drawer chain index. This is used by .
Pop a draw session. This is used by and .
Gets the next property in the , or null if none is found.
Whether to include children or not.
Whether to only include visible properties.
Finds the first parent property that matches a given predicate.
Finds the first child recursively, that matches a given predicate.
Updates the property. This method resets the temporary context, and updates the value entry and the property children.
If true, the property will update regardless of whether it has already updated for the current .
Populates a generic menu with items from all drawers for this property that implement .
Determines whether this property is the child of another property in the hierarchy.
The property to check whether this property is the child of.
other is null
Determines whether this property is a parent of another property in the hierarchy.
The property to check whether this property is the parent of.
other is null
Represents a set of values of the same type as a tree of properties that can be drawn in the inspector, and provides an array of utilities for querying the tree of properties.
Delegate for on property value changed callback.
The component providers that create components for each property in the tree. If you change this list after the tree has been used, you should call tree.RootProperty.RefreshSetup() to make the changes update properly throughout the tree.
The that this tree represents, if the tree was created for a .
The current update ID of the tree. This is incremented once, each update, and is used by to avoid updating multiple times in the same update round.
The type of the values that the property tree represents.
The actual values that the property tree represents.
The number of root properties in the tree.
The prefab modification handler of the tree.
Whether this property tree also represents members that are specially serialized by Odin.
Gets a value indicating whether or not to draw the mono script object field at the top of the property tree.
Gets a value indicating whether or not the PropertyTree is inspecting a static type.
Gets or sets the for the PropertyTree.
Gets or sets the for the PropertyTree.
Gets or sets the for the PropertyTree.
Gets or sets the for the PropertyTree.
An event that is invoked whenever an undo or a redo is performed in the inspector.
The advantage of using this event on a property tree instance instead of
is that this event will be desubscribed from
when the selection changes and the property
tree is no longer being used, allowing the GC to collect the property tree.
This event is invoked whenever the value of any property in the entire property tree is changed through the property system.
Creates a new for all target values of a .
Gets the root property of the tree.
Gets the secret root property of the tree, which hosts the property resolver used to resolve the "actual" root properties of the tree.
Registers that a given property is dirty and needs its changes to be applied at the end of the current frame.
Schedules a delegate to be invoked at the end of the current GUI frame.
The action delegate to be delayed.
Schedules a delegate to be invoked at the end of the next Repaint GUI frame.
The action to be delayed.
Enumerates over the properties of the tree.
Whether to include children of the root properties or not. If set to true, every property in the entire tree will be enumerated.
Whether to only include visible properties. Properties whose parents are invisible are considered invisible.
Gets the property at the given path. Note that this is the path found in , not the Unity path.
The path of the property to get.
Gets the property at the given path. Note that this is the path found in , not the Unity path.
The path of the property to get.
Gets the property at the given Unity path.
The Unity path of the property to get.
Gets the property at the given Unity path.
The Unity path of the property to get.
Gets the property at the given deep reflection path.
The deep reflection path of the property to get.
Gets the property at the given Odin prefab modification path.
The prefab modification path of the property to get.
Gets the property at the given Odin prefab modification path.
The prefab modification path of the property to get.
Draw the property tree, and handles management of undo, as well as marking scenes and drawn assets dirty.
This is a shorthand for calling
,
and .
.
Draws a search bar for the property tree, and draws the search results if the search bar is used.
If this method returns true, the property tree should generally not be drawn normally afterwards.
Note that this method will throw exceptions if the property tree is not set up to be searchable; for that, see .
True if the property tree is being searched and is currently drawing its search results, otherwise false.
Gets a Unity property for the given Odin or Unity path. If there is no for this property tree, or no such property is found in the , a property will be emitted using .
The Odin or Unity path to the property to get.
Gets a Unity property for the given Odin or Unity path. If there is no for this property tree, or no such property is found in the , a property will be emitted using .
The Odin or Unity path to the property to get.
The backing field of the Unity property.
Checks whether a given object instance is referenced anywhere in the tree, and if it is, gives the path of the first time the object reference was encountered as an out parameter.
The reference value to check.
The first found path of the object.
Gets the number of references to a given object instance in this tree.
Updates all properties in the entire tree, and validates the prefab state of the tree, if applicable.
Replaces all occurrences of a value with another value, in the entire tree.
The value to find all instances of.
The value to replace the found values with.
Gets the root tree property at a given index.
The index of the property to get.
Invokes the actions that have been delayed using and .
Applies all changes made with properties to the inspected target tree values, and marks all changed Unity objects dirty.
true if any values were changed, otherwise false
Invokes the OnValidate method on the property tree's targets if they are derived from and have the method defined.
Registers an object reference to a given path; this is used to ensure that objects are always registered after having been encountered once.
The referenced object.
The property that contains the reference.
Creates a PropertyTree to inspect the static values of the given type.
The type to inspect.
A PropertyTree instance for inspecting the type.
Creates a new for a given target value.
The target to create a tree for.
target is null
Creates a new for a set of given target values.
Note that the targets all need to be of the same type.
The targets to create a tree for.
targets is null
Creates a new for all target values of a .
The serialized object to create a tree for.
serializedObject is null
Creates a new for a set of given target values.
Note that the targets all need to be of the same type.
The targets to create a tree for.
Creates a new for a set of given target values, represented by a given .
Note that the targets all need to be of the same type.
The targets to create a tree for.
The serialized object to create a tree for. Note that the target values of the given must be the same values given in the targets parameter.
Sets whether the property tree should be searchable or not, and allows the passing in of a custom SearchableAttribute instance to configure the search.
Whether the tree should be set to be searchable or not.
If the tree is set to be searchable, then if this parameter is not null, it will be used to configure the property tree search. If the parameter is null, the SearchableAttribute on the tree's will be used. If that property has no such attribute, then default search settings will be applied.
Represents a set of strongly typed values as a tree of properties that can be drawn in the inspector, and provides an array of utilities for querying the tree of properties.
This class also handles management of prefab modifications.
Gets the root property of the tree.
Gets the secret root property of the PropertyTree.
Gets the for the PropertyTree.
The current update ID of the tree. This is incremented once, each update, and is used by to avoid updating multiple times in the same update round.
The that this tree represents, if the tree was created for a .
The type of the values that the property tree represents.
The strongly types actual values that the property tree represents.
The weakly types actual values that the property tree represents.
The number of root properties in the tree.
Whether this property tree also represents members that are specially serialized by Odin.
Initializes a new instance of the class, inspecting only the target () type's static members.
Initializes a new instance of the class.
The serialized object to represent.
Initializes a new instance of the class.
The targets to represent.
Initializes a new instance of the class.
The targets to represent.
The serialized object to represent. Note that the target values of the given must be the same values given in the targets parameter.
targets is null
There must be at least one target.
or
A given target is a null value.
Applies all changes made with properties to the inspected target tree values.
true if any values were changed, otherwise false
Registers that a given property is dirty and needs its changes to be applied at the end of the current frame.
Updates all properties in the entire tree, and validates the prefab state of the tree, if applicable.
Checks whether a given object instance is referenced anywhere in the tree, and if it is, gives the path of the first time the object reference was encountered as an out parameter.
The reference value to check.
The first found path of the object.
Gets the number of references to a given object instance in this tree.
Gets the property at the given path. Note that this is the path found in , not the Unity path.
The path of the property to get.
Gets the property at the given path. Note that this is the path found in , not the Unity path.
The path of the property to get.
Finds the property at the specified unity path.
The unity path for the property.
The property found at the path.
Finds the property at the specified unity path.
The unity path for the property.
The property found at the path.
Finds the property at the specified modification path.
The prefab modification path for the property.
The property found at the path.
Finds the property at the specified modification path.
The prefab modification path for the property.
The property found at the path.
Gets a Unity property for the given Odin or Unity path. If there is no for this property tree, or no such property is found in the , a property will be emitted using .
The Odin or Unity path to the property to get.
The backing field of the Unity property.
Enumerates over the properties of the tree. WARNING: For tree that have large targets with lots of data, this may involve massive amounts of work as the full tree structure is resolved. USE THIS METHOD SPARINGLY AND ONLY WHEN ABSOLUTELY NECESSARY!
Whether to include children of the root properties or not. If set to true, every property in the entire tree will be enumerated.
/// Whether to only include visible properties. Properties whose parents are invisible are considered invisible.
Replaces all occurrences of a value with another value, in the entire tree.
The value to find all instances of.
The value to replace the found values with.
The value to replace with must either be null or be the same type as the value to replace (" + from.GetType().Name + ").
Gets the root tree property at a given index.
The index of the property to get.
Schedules a delegate to be invoked at the end of the current GUI frame.
The action delegate to be delayed.
action
Schedules a delegate to be invoked at the end of the next Repaint GUI frame.
The action to be delayed.
action
Invokes the actions that have been delayed using and .
Enumeration describing the different types of properties that exist.
Property represents a value.
Property represents a method.
Property represents a named group of properties.
Enumeration for designating whether a has a special state,.
The value entry has no special state.
The property is a reference to another property. Get the path of the referenced property from .
The value entry is a null value.
The value entry has a primitive value conflict across selected indices.
A primitive value conflict is when primitive values, such a strings or floats, differ.
The value entry has a reference value conflict across selected indices.
A reference value conflict is when the types of reference type values differ, or when some values are null while others are not.
The value entry has a reference path conflict across selected indices.
A reference path conflict is when the property consists of references to many conflicting paths. Use to get paths to all referenced objects.
The value entry has a collection length conflict across selected indices.
A collection length conflict is when the property represents multiple parallel collections, and their lengths differ.
Class that describes the different possible serialization backends that a property can have,
and specifies the capabilities of each backend.
The property is serialized by Unity's polymorphic serialization backend via the [SerializeReference] attribute. Polymorphism, null values and cyclical references are supported.
The property is serialized by Unity's classic serialization backend. Polymorphism, null values and types such as are not supported.
The property is serialized by Odin. Polymorphism, null values and types such as are supported.
The property is not serialized by anything - possibly because it is a method, possibly because it is a field or property shown in the inspector without being serialized.
In the case of fields or properties, polymorphism, null values and types such as are supported, but will not be saved.
The property is not serialized by anything - possibly because it is a method, possibly because it is a field or property shown in the inspector without being serialized.
In the case of fields or properties, polymorphism, null values and types such as are supported, but will not be saved.
The property is serialized by Unity's classic serialization backend. Polymorphism, null values and types such as are not supported.
The property is serialized by Unity's polymorphic serialization backend via the [SerializeReference] attribute. Polymorphism, null values and cyclical references are supported.
The property is serialized by Odin. Polymorphism, null values and types such as are supported.
An internally used interface that is used by value entries during , that lets value entries force each other to set values directly to their target objects.
This interface should not be used by people who do not know what they are doing.
Sets the actual value of a value entry, for a given selection index.
An internally used interface that is used by value entries during , that lets value entries force each other to set values directly to their target objects.
This interface should not be used by people who do not know what they are doing.
Sets the actual value of a value entry, for a given selection index.
Represents the values of an , and contains utilities for querying the values' type and getting and setting them.
Delegate type used for the events and .
The nearest parent property that has a value.
That is, the property from which this value
entry will fetch its parentvalues from in order
to extract its own values.
If is null, this is a root property.
Whether this value entry represents a boxed value type.
The number of parallel values this entry represents. This will always be exactly equal to the count of .
Whether this value entry is editable or not.
If this value entry has the override type , this is the path of the property it references.
The actual serialization backend for this value entry, possibly inherited from the serialization backend of the root property this entry is a child of.
Note that this is *not* always equal to .
The property whose values this value entry represents.
Provides access to the weakly typed values of this value entry.
Whether this value entry has been changed from its prefab counterpart.
Whether this value entry has had its list length changed from its prefab counterpart.
Whether this value entry has had its dictionary values changes from its prefab counterpart.
A weakly typed smart value that represents the first element of the value entry's value collection, but has "smart logic" for setting the value that detects relevant changes and applies them in parallel.
This lets you often just use the smart value instead of having to deal with the tedium of multiple parallel values.
The type from which this value entry comes. If this value entry represents a member value, this is the declaring type of the member. If the value entry represents a collection element, this is the type of the collection.
The most precise known contained type of the value entry. If polymorphism is in effect, this will be some type derived from .
The base type of the value entry. If this is value entry represents a member value, this is the type of the member. If the value entry represents a collection element, this is the element type of the collection.
The special state of the value entry.
Whether this value entry is an alias, or not. Value entry aliases are used to provide strongly typed value entries in the case of polymorphism.
The context container of this property.
Whether this type is marked as an atomic type using a .
An event that is invoked during , when any values have changed.
An event that is invoked during , when any child values have changed.
Updates the values contained in this value entry to the actual values in the target objects, and updates its state (override, type of value, etc.) accordingly.
Checks whether the values in this value entry are equal to the values in another value entry.
Note, both value entries must have the same value type, and must represent values that are .NET value types.
Applies the changes made to this value entry to the target objects, and registers prefab modifications as necessary.
True if any changes were made, otherwise, false.
Determines the value state of this value entry.
Determines what the most precise contained type is on this value entry.
Updates all values in this value entry from the target tree values.
Initializes this value entry.
Creates an alias value entry of a given type, for a given value entry. This is used to implement polymorphism in Odin.
Creates a value entry for a given property, of a given value type. Note that the created value entry is returned un-updated, and needs to have called on it before it can be used.
Determines whether the value at the given selection index is different from the given prefab value, as is relevant for prefab modification checks.
If the value is a reference type, null and type difference is checked. If value is a value type, a comparer from is used.
This method is best ignored unless you know what you are doing.
The value to check differences against.
The selection index to compare against.
Represents the values of an , and contains utilities for querying the values' type and getting and setting them.
The type of the value.
An equality comparer for comparing values of type . This is gotten using .
Whether .is a primitive type; that is, the type is primitive, a string, or an enum.
Whether is a value type.
Whether is derived from .
Whether the type of the value is marked atomic.
If the type of the value is marked atomic, this an instance of an atom handler for the value type.
Initializes a new instance of the class.
Provides access to the weakly typed values of this value entry.
Provides access to the strongly typed values of this value entry.
Whether this type is marked as an atomic type using a .
A weakly typed smart value that represents the first element of the value entry's value collection, but has "smart logic" for setting the value that detects relevant changes and applies them in parallel.
This lets you often just use the smart value instead of having to deal with the tedium of multiple parallel values.
A strongly typed smart value that represents the first element of the value entry's value collection, but has "smart logic" for setting the value that detects relevant changes and applies them in parallel.
This lets you often just use the smart value instead of having to deal with the tedium of multiple parallel values.
An array containing the original values as they were at the beginning of frame.
An array containing the current modified set of values.
An array containing the current modified set of atomic values.
An array containing the original set of atomic values.
Initializes this value entry.
Sets the actual target tree value.
Checks whether the values in this value entry are equal to the values in another value entry.
Note, both value entries must have the same value type, and must represent values that are .NET value types.
Determines whether the value at the given selection index is different from the given prefab value, as is relevant for prefab modification checks.
If the value is a reference type, null and type difference is checked. If value is a value type, a comparer from is used.
This method is best ignored unless you know what you are doing.
The value to check differences against.
The selection index to compare against.
Determines whether the value at the given selection index is different from the given prefab value, as is relevant for prefab modification checks.
If the value is a reference type, null and type difference is checked. If value is a value type, a comparer from is used.
This method is best ignored unless you know what you are doing.
The value to check differences against.
The selection index to compare against.
Represents the values of an , and contains utilities for querying the values' type and getting and setting them.
The type of the parent.
The type of the value.
The type from which this value entry comes. If this value entry represents a member value, this is the declaring type of the member. If the value entry represents a collection element, this is the type of the collection.
Determines what the most precise contained type is on this value entry.
Initializes this value entry.
Updates all values in this value entry from the target tree values.
Determines the value state of this value entry.
Applies the changes made to this value entry to the target objects, and registers prefab modifications as necessary.
True if any changes were made, otherwise, false.
Gets the parent value at the given index.
Adds menu items to the Unity Editor, draws the About window, and the preference window found under Edit > Preferences > Odin Inspector.
Not yet documented.
Not yet documented.
Not yet documented.
Not yet documented.
Not yet documented.
Not yet documented.
Not yet documented.
Sirenix preferences window.
Open preferences page for configuration object.
Opens the Odin inspector preferences window.
Opens the Odin inspector preferences window.
This class has been made fully obsolete, and has been replaced by .
It was a helper class to handle strings for labels and other similar purposes.
If any error occurred while looking for members, it will be stored here.
Obsolete. Use other constructor.
Obsolete. Use other constructor.
Creates a StringMemberHelper to get a display string.
Inspector property to get string from.
The input string. If the first character is a '$', then StringMemberHelper will look for a member string field, property or method, and will try to parse it as an expression if it starts with '@'.
Creates a StringMemberHelper to get a display string.
Inspector property to get string from.
The input string. If the first character is a '$', then StringMemberHelper will look for a member string field, property or method, and will try to parse it as an expression if it starts with '@'./// The input string. If the first character is a '$', then StringMemberHelper will look for a member string field, property or method.
Gets a value indicating whether or not the string is retrived from a from a member.
Gets the type of the object.
Gets the string from the StringMemberHelper.
Only updates the string buffer in Layout events.
The property entry, to get the instance reference from.
The current display string.
Gets the string from the StringMemberHelper.
Only updates the string buffer in Layout events.
The property, to get the instance reference from.
The current string.
Gets the string from the StringMemberHelper.
Only updates the string buffer in Layout events.
The instance, for evt. member references.
The current string.
Gets the string from the StringMemberHelper.
The property entry, to get the instance reference from.
The current string.
Gets the string from the StringMemberHelper.
The property, to get the instance reference from.
The current string.
Gets the string from the StringMemberHelper.
The instance, for evt. member references.
The current string.
Gets a unique key for any given property within a drawer.
public class MyCustomTypeDrawer<T> : OdinValueDrawer<T> where T : MyCustomBaseType
{
protected override void DrawPropertyLayout(IPropertyValueEntry<T> entry, GUIContent label)
{
var isToggled = entry.Context(this, "toggled", false);
isToggled.Value = SirenixEditorGUI.Label(isToggled.Value, label);
if (SirenixEditorGUI.BeginFadeGroup(UniqueDrawerKey.Create(entry, this), isToggled.Value))
{
EditorGUI.indentLevel++;
this.CallNextDrawer(entry.Property, null);
EditorGUI.indentLevel--;
}
SirenixEditorGUI.EndFadeGroup();
}
}
Gets a unique key for any given property within a drawer.
The property entry.
The drawer.
Gets a unique key for any given property within a drawer.
The property.
The drawer.
Checks if two keys are identical.
The other key.
Checks if two keys are identical.
Returns a hash code for this instance.
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Unity property drawer.
Initializes the property drawer.
Draws the property.
Provides utilities for emitting ScriptableObject and MonoBehaviour-derived types with specific property names and types, and providing instances of with those names and types.
A handle for a set of emitted Unity objects. When disposed (or collected by the GC) this handle will queue the emitted object instances for destruction.
The unity property to represent.
The Unity objects to represent.
Initializes a new instance of the class.
The unity property to represent.
The objects to represent.
Finalizes an instance of the class.
Creates an emitted MonoBehaviour-based .
Name of the field to emit.
Type of the value to create a property for.
The target count of the tree to create a property for.
The game object that the MonoBehaviour of the property is located on.
fieldName is null
or
valueType is null
Target count must be equal to or higher than 1.
Creates an emitted ScriptableObject-based .
Name of the field to emit.
Type of the value to create a property for.
The target count of the tree to create a property for.
fieldName is null
or
valueType is null
Target count must be equal to or higher than 1.
Context that persists across reloading and restarting Unity.
Time stamp for when the persistent context value was last used.
Used for purging unused context.
Instatiates a persistent context.
Updates the time stamp to now.
Context that persists across reloading and restarting Unity.
The type of the context value.
The value of the context.
Creates a new persistent context object.
Formats a string with the time stamp, and the value.
Helper class that provides a local copy of a .
When the local value is changed, it also changed the global value, but the global value does not change the local value.
The type of the context value.
The value of the context.
Changing this value, also changes the global context value, but the global value does not change the local value.
Creates a local context object for the provided global context.
The global context object.
Updates the local value to the current global value.
OdinDrawer extensions.
Gets a persistent value that will survive past multiple Unity Editor Application sessions.
The value is stored in the PersistentContextCache, which has a customizable max cache size.
Provides context objects that still persist when Unity reloads or is restarted.
Gets a GlobalPersistentContext object for the specified key.
The type of the first key.
The type of the value stored in the context object.
The first key.
The default value, used for when the context object is first created.
Gets a GlobalPersistentContext object for the specified keys.
The type of the first key.
The type of the second key.
The type of the value stored in the context object.
The first key.
The second key.
The default value, used for when the context object is first created.
Gets a GlobalPersistentContext object for the specified keys.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The default value, used for when the context object is first created.
Gets a GlobalPersistentContext object for the specified keys.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the fourth key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The fourth key.
The default value, used for when the context object is first created.
Gets a GlobalPersistentContext object for the specified keys.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the fourth key.
The type of the fifth key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The fourth key.
The fifth key.
The default value, used for when the context object is first created.
Gets a GlobalPersistentContext object for the specified key.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the value stored in the context object.
The first key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Gets a GlobalPersistentContext object for the specified keys.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the second key.
The type of the value stored in the context object.
The first key.
The second key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Gets a GlobalPersistentContext object for the specified keys.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Gets a GlobalPersistentContext object for the specified keys.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the fourth key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The fourth key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Gets a GlobalPersistentContext object for the specified keys.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the fourth key.
The type of the fifth key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The fourth key.
The fifth key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Gets a LocalPersistentContext object for the specified key.
The type of the first key.
The type of the value stored in the context object.
The first key.
The default value, used for when the context object is first created.
Gets a LocalPersistentContext object for the specified keys.
The type of the first key.
The type of the second key.
The type of the value stored in the context object.
The first key.
The second key.
The default value, used for when the context object is first created.
Gets a LocalPersistentContext object for the specified keys.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The default value, used for when the context object is first created.
Gets a LocalPersistentContext object for the specified keys.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the fourth key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The fourth key.
The default value, used for when the context object is first created.
Gets a LocalPersistentContext object for the specified keys.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the fourth key.
The type of the fifth key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The fourth key.
The fifth key.
The default value, used for when the context object is first created.
Gets a LocalPersistentContext object for the specified key.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the value stored in the context object.
The first key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Gets a LocalPersistentContext object for the specified keys.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the second key.
The type of the value stored in the context object.
The first key.
The second key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Gets a LocalPersistentContext object for the specified keys.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Gets a LocalPersistentContext object for the specified keys.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the fourth key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The fourth key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Gets a LocalPersistentContext object for the specified keys.
Returns true when the context is first created. Otherwise false.
The type of the first key.
The type of the second key.
The type of the third key.
The type of the fourth key.
The type of the fifth key.
The type of the value stored in the context object.
The first key.
The second key.
The third key.
The fourth key.
The fifth key.
The persistent context object.
Returns true when the context is first created. Otherwise false.
Persistent Context cache object.
Estimated cache size in bytes.
The current number of context entries in the cache.
If true then persistent context is disabled entirely.
If true the context will be saved to a file in the temp directory.
The max size of the cache in bytes.
Delete the persistent cache file.
Access the StaticInspectorWindow from Tools > Odin Inspector > Static Inspector.
Member filter for access modifiers.
include public members.
Include Non-public members.
Include both public and non-public members.
Member filter for member types.
No members included.
Include field members.
Include property members.
Include method members.
Include group members.
Include members from the base types.
Include members marked with the Obsolete attribute.
Include all members except members marked with the Obsolete attribute.
Shows the window.
Opens a new static inspector window for the given type.
Draws the Odin Editor Window.
Draws the editor for the this.CurrentDrawingTargets[index].
Contains references to UnityEngine.Networking types. These types have been removed in Unity 2019+, and thus may be null.
Contains configuration for generating an assembly that provides increased AOT support in Odin.
Whether to automatically scan the project and generate an AOT dll, right before builds. This will only affect platforms that are in the list.
**This will only work on Unity 5.6 and higher!**
Whether to automatically delete the generated AOT dll after a build has completed.
A list of platforms to automatically scan the project and generate an AOT dll for, right before builds. This will do nothing unless is true.
The path to the AOT folder that the AOT .dll and linker file is created in, relative to the current project folder.
Scans the entire project for types to support AOT serialization for.
Generates an AOT DLL, using the current configuration of the AOTGenerationConfig instance.
The Odin Inspector Serialization Debugger Window.
Opens the Serialization Debugger Window with the last debugged type.
Opens the Serialization Debugger Window and debugs the given type.
The type to debug serialization of.
Initializes the Serialization Debugger Window.