Odin Inspector Version 1.0.5.3

Highlights

We've tracked down and fixed the issue that a lot of you were having with dropdowns changing the wrong values. Sorry for the inconvencience, and, as always, a big thank you to everyone who helped us track it down by providing examples that let us reproduce the problem.

Fixes

  • Fixed an issue where the object fields would break control id's, causing enums and dropdowns to sometimes change the value of a different member than intended.
  • Fixed massive number of cases where value changes would not be registered properly by Odin. This particularly affected value changes triggered by dropdown menus, and meant that objects would sometimes not be marked dirty when they should, and prefab instances would not be updated when the prefab itself was changed.
  • Fixed case where pasting a value in the inspector would not properly mark an object as dirty, sometimes causing pasted values to be lost on reload.
  • Fixed error in multiselection where, if a value was dragged onto a UnityObject field, the UnityObject values wouldn't change if the dragged object was the same as the first selected object value.
  • Fixed error in multiselection where "parallel" UnityObjects wouldn't be detected as a null property if all of them were null.
  • Fixed error in multiselection where "parallel" UnityObjects wouldn't have a value conflict detected if none of them were null, but they were still different object references.
  • Fixed case where ListDrawer would throw constant NullReferenceExceptions if ListElementLabelName was set and ShowIndexLabels was false or not set to true globally.
  • Fixed a few cases where quaternions values wouldn't be able to be changed properly in raw mode.
  • Serialization of types derived from Dictionary<TKey, TValue> now works properly, instead of breaking the derived dictionary's internal values completely.
  • A dictionary's comparer is now also serialized along with the dictionary itself. This means comparers in serialized dictionaries are no longer reset to default constantly.

Changes

  • Improved a lot of label-width alignments.
  • When you hit the add button on a list of delegates, a null delegate is now instantly added to the list, rather than going through the object picker UI
  • Downgraded annoying and mostly irrelevant error messages from the DelegateFormatter's deserialization code to warnings instead.
  • Deserialization logic now attempts to recover from cases where the stated serialized format does not match the serialized data itself, and performs better logging if this very odd case should ever occur again.

Additions

  • Added custom formatter for KeyValuePair<TKey, TValue>, so they can also be serialized outside of the context of the standard dictionary formatter.
  • Added GUIHelper.ActualLabelWidth which returns the raw value of EditorGUIUtility.labelWidth.

Odin Inspector Version 1.0.5.2

Additions

  • AOT Generation: Added ability to automatically scan the project and generate an AOT dll whenever a build is started. This is off by default, but can be enabled in the AOT Generation preferences. This feature is only available in Unity 5.6 and above.
  • Added a new class called DragAndDropUtilities for easier adding good drag and drop support to varius feature throughout Odin. It out of the box adds support for moving, copying, swapping and selecting values, for both Unity Object and non-Unity types alike.

    Two Dimensional arrays are the first to use this new API. See the gif down below.
  • Added 3 new properties to the TableMatrix attribute:
    • SquareCells: Automatically resizes the height of each cell to match its width.
    • HideColumnIndices and HideRowIndices: Hides the horizontal and vertical rows on tables. Note that this will also currently prevent the user from adding, removing and dragging rows and columns.
      Note: You can hold Shift to copy, and hold ctrl and click the top right button to quickly remove an item.
  • The EnableIf, DisableIf, ShowIf and HideIf attributes now support enum values.
  • The ColorPalette attribute now also works with the $ sign.
  • Added a Draw(rect) method to EditorIcons which handles linear color space, and renders the icon with a custom-shader that makes the icon look crisp and nice. This fixes the bug where all of Odin's icons would be black in the inspector, if linear color space is enabled in the project.
  • Added inspector and serialization support for .NET Tuple classes (not the C# 7.0 tuple feature) when using the new 4.6 scripting backend on Unity 2017.1 and above.
  • You can now pass a generic parameter as the drawn attribute type on Odin attribute drawers and use generic constraints to narrow down which attributes it can draw.
  • Added a ReadOnly option to the FilePath attribute.
  • Whether lists shouls show index labels by default can now be specified in the Odin preferences window.
  • Added the "AlwaysAddDefaultValue" to ListDrawerSettings, which, if enabled, causes the Add button to instantly add a default value when clicked without ever bringing up an object/type picker.
  • Added nice, instructive error messages when the serialization system encounters a type with missing AOT support at runtime. This replaces the former chaotic bombardment of confusing, scary error messages that people were getting.
  • The delegate drawer can now also be drawn on non-Unity objects.
  • Added OnPropertyValueChanged event to PropertyTree, which is invoked every time a value is changed on any property in the tree.
  • The Horizontal Group attribute now has a LabelWidth property.

Changes

  • Overhauled the UI for the delegate drawer, making it much simpler. Note, that you can no longer navigate the Scene via the context-menu drop down. Instead, you drag in the target object and find the method you want to reference.
  • Renamed "DirectoryInfoExtensions.IsSubDirectoryOf" to "DirectoryInfoExtensions.HasSubDirectory" to reflect what the method actually does.
  • Color palettes can now be accessed and modified from code. Note that the color palettes will NOT automatically be included in your builds. But you can now easily fetch all color palettes via the ColorPaletteManager and include them in your game like so:
  • Simplified the Persistent Context window and the Color Palettes window.
  • The height of the instance creater window now matches the size of its content.
  • MemberInfos are no longer drawn by the references drawer.

Fixes

  • Fixed issue where paging on table lists was broken.
  • Fixed issue where running a scene validation scan had a high likelihood of crashing the editor on Mac OSX. The cause of the crash was the progress bar dialog, so the validation scan no longer shows a progress bar on Mac OSX.
  • Fixed cases where, in some versions of Unity from 2017.1 and up, AnimationCurve and Gradient wouldn't be rendered properly by Odin, when serialized only by Odin and not by Unity.
  • Fixed bug where declaring two [CustomPropertyDrawer] attributes with the same type argument on a legacy PropertyDrawer would cause Odin's drawer locator to explode. It now correctly only registers the drawer once for that type argument.
  • Fixed issue where you could still drag Unity objects into a list, even if IsReadOnly was set to true using the [ListDrawerSettings] attribute.
  • Fixed error where passing an AbsolutePath = true parameter to the [FolderPath] attribute would cause a null reference exception if you click the folder icon with an empty string as the current path value.
  • Fixed error in binary deserialization where some data might be lost if the data layout changes between serialization and deserialization in a way that necessitates skipping over primitive entry types without a formatter. This was the cause of a lot of the "InvalidOperationException: Invalid binary data stream: could not parse peeked BinaryEntryType byte '0' into a known entry type." errors that some people were seeing sporadically.
  • Fixed a bug where Odin incorrectly assumed that Unity would serialize UnityEngine.Object types with generic type arguments.
  • Fixed a bug where the remove dictionary item button would be drawn even when DictioanryDrawerSetttings.IsReadOnly is true.
  • Odin now correctly guesses that Unity will not serialize Coroutines.
  • Added lots of safety clauses in various places to ensure that Odin never creates a default instance of a Coroutine, as these instances will cause Unity to crash the moment one is garbage collected.
  • Fixed a bug where the persistent cache file path could contain illegal characters.
  • AOT Generation: Fixed an error where the AOT Generation scan would only scan scenes, not project assets.
  • AOT Generation: Scanning the project will no longer save scenes or assets when scanning, so scene files and assets will no longer be modified by a scan.
  • AOT Generation: Fixed errors where, in some cases, the AOT Generation scan would not find types which needed AOT support. It should now be far better at finding all types that need support. This was particularly causing issues for dictionaries with enum keys.
  • You can now drag texture assets containing sprites into sprite lists, and as is the default Unity behaviour, the first sprite in the asset will be added.
  • Sprite values in members (not collection elements) are now drawn with the proper Sprite GUI.
  • Clicking the "Inspect object" icon on Sprites now inspects the main texture asset rather than the sprite sub-asset.
  • Fixed various errors where the serialization system did not respond correctly to SerializationAbortExceptions being thrown.
  • UnityEventDrawer is now better about showing a relevant error message when a UnityEvent has been declared in an unsupported manner.
  • Exceptions thrown while Odin is drawing are now displayed better in the console, and not confusingly split between two different console messages.
  • Fixed a bug where ctrl+clicking a polymorphic object field or ctrl+clicking the add button of a polymorphic list, in order to select the first instance without opening the instance creator window, would throw a harmless error in the console.
  • Fixed a bug where Odin would sometimes find the wrong equality operator for comparing values on types with multiple equality operators.
  • Fixed a bug where some paths used by the persistent context window were invalid on Mac.
  • Fixed a bug where double clicking on a property with the file or folder path attribute, with a path that does not exist in Unity, would cause an error in the console.
  • Fixed bug where generic drawer resolution would throw exceptions if it encountered a generic parameter with a constraint to another generic parameter which is a struct, while resolving a partially constructed generic drawer.
  • Fixed bug where generic drawer resolution would incorrectly resolve partially constructed generic drawers by failing to take the partially constructed arguments into account when checking constraints.
  • Fixed bug where Odin's registration of Unity legacy drawers did not take the "useForChildren" argument on the CustomPropertyDrawer attribute into account.
  • Fixed issue where Scene Validator Window wouldn't find inactive game objects.
  • Fixed issue where the AOT Sirenix.Serialization.AOTGenerated.dll generated on Mac would be slightly invalid and cause internal compiler exceptions when building to iOS.
  • Force renamed AoTGenerationConfig.cs to AOTGenerationConfig.cs to reflect the exact class name capitalization. This was causing issues when using Odin in source mode.
  • Fixed a bug in the DeepReflection utility where creating emitted member getters wouldn't box value types when needed.
  • Fixed a bug where properties drawn by Unity PropertyDrawers would not work in Unity 2017.1 and above.
  • Fixed issue where the ColorUsage attribute would cause the color value to be unable to be edited.
  • The GUIHelper extension method RepaintIfRequested(Editor editor) now also requests a repaint on the currently drawing window if that window is not an inspector window. This ensures that users using Editor.CreateEditor to draw inspectors in custom editor windows no longer get a "laggy" window due to repaint requests not triggering correctly from inside the created editor instance.
  • The drawer for the [InlineButton] attribute now has a wrapper priority of (0, 1, 0) instead of the default value priority of (0, 0, 1), causing it to work correctly with attributes such as [ValueDropdown].
  • Fixed issue where the [AssetList] attribute would not work on Mac if a path constraint was specified.
  • Fixed issue where changing object values in an AssetList through the asset list dropdown could cause UI layout exceptions to be thrown.
  • Fixed issue where ExitGUIExceptions thrown inside an InlineEditor (for example when opening the color picker) would cause CurrentInlineEditorDrawDepth to not be decremented, thus permanently ticking up the current draw depth, and eventually causing all properties to be blocked from drawing due to the draw depth cutoff.
  • Editor Only mode now disables the link.xml file, and moves the Global Serialization Config file out of the resources folder which was preventing people to build to some platforms while in the Editor Only mode.
  • Fixed issue where adding new elements in a Unity-serialized list that could reference Unity objects would cause said Unity objects, such as GameObjects and ScriptableObjects, to be created using their default new() constructors, if they had any.
  • Fixed an issue where CustomValueDrawers didn't override some existing value drawers.
  • Made some minor improvements to TabGroups.
  • Animations throughout Odin should now appear a lot smoother and more consistent.
  • Fixed an issue where TypeExtensions.GetBaseTypes(includeSelf: true) didn't include itself if the given type was an interface.
  • Config files now support being relocated to anywhere in the project. This means that the Serialization Config file can now be taken out of the resources folder, which is required by some platforms when using Odin in Editor Only mode.
  • Updated documentation for SirenixEditorGUI.DynamicPrimitiveField, to reflect added type support for Guid and enums.

Odin Inspector Version 1.0.5.1

Fixes

  • Fixed inspectors that draw null Unity objects marking the current scene dirty constantly.
  • Fixed an issue where paging on TableLists would not work with more than two pages.
  • Fixed an issue where referring to properties and methods inside structs via attributes such as [ShowIf] would not work.
  • Custom defined user script assemblies (formerly Unity 2017.2, now Unity 2017.3 feature) are now considered plugin assemblies, not Unity assemblies. This was causing types defined in such assemblies to not be rendered properly in the inspector.
  • DelegateDrawer now correctly handles delegate instances that have a null method reference. This was causing drawn UnityAction delegates to throw null reference exceptions.
  • GuessIfUnityWillSerialize now correctly guesses that Unity will never serialize delegates, not even UnityAction delegates.
  • Fixed error message about not being able to resolve or find the file "Default Dynamic Module" in the generated AOT folder when generating an AOT dll. The module "Default Dynamic Module" is no longer included in the saved assembly's IL code.
  • Fixed issue where the persistent context cache would incorrectly create new key entries rather than preserving the old ones, if persistent context entries were requested immediately after script reload by the currently selected object.

Changes

  • Renamed "DirectoryInfoExtensions.IsSubDirectoryOf" to "DirectoryInfoExtensions.HasSubDirectory" to reflect what the method actually does.

Additions

  • The Instance Creator Window will now show if an instance can't be created because no default constructor was found.

Odin Inspector Version 1.0.5.0

Upgrade notes

  • After upgrading, you can freely delete the Sirenix/Assemblies/Editor folder and whatever version controlled files you had in it before for ignoring the now defunct GeneratedOdinEditors.dll files.

Highlights

  • Say goodbye to GeneratedOdinEditors.dll

    We have adopted a new, DLL-free method for making Unity draw Odin's inspectors, that does not rely on declaring editor types with CustomEditor attributes on them. This means that Odin will no longer cause an extra recompilation every time you change your types, and that Odin can instantly update which types it draws at runtime when you change the settings, without any reloads at all.

    Additionally, this means that we have now lifted all of the prior restrictions on which types could be drawn by Odin (IE, only public types with valid C# names, that did not share full names with other types and were not declared in assemblies with spaces in their name).

    Finally, this should resolve all crash bugs and hang issues that generating editors were causing in 2017.1 and 2017.2.

  • Persistent Editor States

    Odin now features a new Persistent Context system. Now when you switch to a different tab, close a foldout, or select a different color palette, and leave, you can come back and find the inspector in the state you left it. This is great for when you have a lot of objects, and you're jumping between them a lot.

    This works when switching between objects, when Unity reloads and even after Unity has been shut down and restarted. The Persistent Context system will cache your inspector state until the cache reaches a configurable size.
    At this point, it'll clean out older states, in order to keep itself within the memory limit.

    You can change the size of your cache, or completely disable the caching altogether from the Persistent Context preferences window in 'Tools > Odin Inspector > Preferences > Persistent Context'.

  • Dictionary Key Type Support

    Dictionaries now support having keys of any type, except on prefab instances, where key type support is still limited.

    Dictionary key type support on prefab instances is now extendable for value type keys. See here for details.

  • AOT Support

    Added serialization AoT generation for generic type variants, which should help fix all serialization issues on IL2CPP/AoT platforms that were caused by no AoT code being generated for the needed generic variants of relevant methods and types.
  • Two Dimensional Arrays and List Tables

    Odin can now show two-dimensional arrays as tables in the inspector. The tables can be modified using the new TableMatrix attribute.

  • A new TableList has been introduced enabling you to render a list as a table. The width of the table columns can be modified via the TableColumnSize attribute.
    Note: the TableList attribute does not yet have support for drag and drop, but it contains a button that toggles between the regular list and the table list attribute so, for now, you need to switch to the regular list view if you want to modify the item order.
  • Editor Only Mode

    You can now completely enable and disable the Odin Serialization system via a single button located in our new Toggle Serialization window found in Tools > Odin Inspector > Preferences. The Odin Preferences window now has a new window called "Toggle Serialization"

New Attributes

  • Added a new attribute called CustomValueDrawer which lets you create a custom property drawer with a single method. This is especially useful in cases where you need a one-time custom thing and you don't want to go through the trouble of creating a new attribute and a new attribute drawer just for that. These drawers will out of the box have support for undo/redo and multi-selection, and you can still combine them with other attributes as well.
  • Using the new Folder- or FilePath attributes, you can now easily edit directory paths in the inspector. Use the dialog window, or drag and drop assets from your project view onto your path fields. Get paths that are relative to Unity, or anywhere else. Double click the properties to highlight the targets in the project view.
  • Using the new ProgressBar attribute, you can visually display and even edit any percentage. Use it to create a healthbar, or display how full an inventory is. You could also make a stacked healthbar, that switches color when one bar is filled. Similar to what you might find in a fighting game.
  • Added SuffixLabel attribute that draws a label at the end of a property. Useful for conveying the nature of a property.

Fixes

  • Made a multitude of fixes to Odin-serialized prefab instances. They should now be far more reliable, and mimic Unity's own behaviour very closely.
    • Fixed error where dragging reference types in Odin-serialized lists on prefab instances could sometimes result in invalid references being serialized in the modifications, causing lost values and unintended reference properties.
    • Applying changes to a prefab instance should now wipe Odin prefab modifications for all components in the entire prefab's hierarchy, not just the ones on the currently selected GameObject.
    • Fixed case where the "Revert to prefab value" context menu item would always be disabled for properties on non-Odin-serialized objects.
    • Fixed issue where Odin-serialized Unity object references on prefab instances would often be set to the references on the prefab instead.
    • Odin-serialized references to scene objects in prefab instances no longer become null when the prefab instance is applied.
    • Odin-serialized references to scene objects are no longer automatically marked as changed prefab values when they correspond directly to the same local prefab object reference on their prefab.
    • Odin-serialized Color and Color32 values can now be properly changed on prefab instances. To facilitate this, Color and Color32 have been marked atomic.
    • Fixed crash that would happen sometimes when changing modified values on Odin-serialized prefab instances that are in prefabs with a hierarchy that contains UI components.
  • Fixed a bug where the the Instance Creator Window could not find interface types that with a generic type definitions.
  • Fixed invalid generic argument error when creating serialization formatters for multidimensional arrays on .NET 4.6.
  • Fixed a bug where the GUIStyle drawer did not support labels being null.
  • Fixed a bug with the AlignCenter Rect extension.
  • Fixed error where emitting formatters for a type with a serialized member that has the same name as an inherited serialized member would cause Unity to crash.
  • Fixed error where CTRL-clicking a null value to instantly populate it with a new type instance would sometimes cause an exception to be thrown.
  • Fixed issue with DisplayAsString where the string wouldn't overflow if the property was drawn with a label.
  • Fixed [LabelText] not working on gradients.
  • Fixed Gradients showing "Element 0", "Element 1", etc labels when displayed in lists, in cases where there should be no labels at all.
  • Fixed case where Odin would only register a Unity PropertyDrawer to draw one type, even if it has several CustomPropertyDrawer attributes on it.
  • Fixed null reference exception that would occur when a property without a setter was marked for serialization. (It would not serialize regardless, as both a getter and a setter is needed.)
  • Fixed issue where RectDrawer didn't respect the 'Expand Foldouts by Default' setting in General Drawer Config.
  • Fixed ValueDropdown attribute not working on list elements.
  • Fixed issue where layer 31 could not be selected for LayerMasks properties.
  • Fixed issue with quaternion fields being hard to use.
  • Fixed case where an invalid cast exception would be thrown for a frame or two when a polymorphic value is changed to another polymorphic value of a different type.
  • Fixed case where overriding equality operators and GetHashCode to implement custom object equality, would incorrectly result in references being serialized and shown in the inspector, for objects which were equal, but not the same references.
  • If a deserialized value implements IObjectReference, other references to that object in the deserialized graph will now correctly point to the value retrieved using IObjectReference.GetRealObject()
  • Multidimensional arrays now become single "regular" reference type properties with no children, instead of causing exceptions in the inspector.
  • DefaultSerializationBinder can now handle type lookups when types are declared in assemblies that have names with spaces in them.
  • The property system can now handle IList and IList<T> implementations that throw NotSupportedExceptions and NotImplementedExceptions in the IsReadOnly property getter. In these cases, it is assumed by default that the list is *not* readonly.
  • DetailedMessageBox no longer uses a control ID, which could be disruptive for other GUI controls when appearing and disappearing.
  • Made a potential fix to the issue where all Sirenix icons would be rendered black for some people. We still don't what causes them to be black, so feedback to whether or not the fix worked would be much appreciated.
  • AssemblyUtilities class now also registers assemblies that are loaded late, after the initial assembly scan has been performed.
  • Newly added list and array elements in Unity-serialized lists and arrays are now properly initialized (and not null) by the time OnValueChanged is called.

Changes

  • Moved Odin's menu items from "Window > Odin Inspector" to "Tools > Odin Inspector" to properly follow Unity's guidelines for assets.
  • Made various upgrades to quaternion drawing
    • Quaternion fields now better detect when they're being edited, and are therefore able to be edited and updated in the inspector from script.
    • Quaternion fields now have a refresh button, which updates the value in the inspector, to accurately show the internal quaternion value.
    • DetailedMessageBox now has it's own style in SirenixGUIStyles, instead of temporarily modifying SirenixGUIStyles.MessageBox.
    • Added new quaternion field methods to SirenixEditorFields. All old quaternion methods have been marked as obsolete.
  • Unity ObjectFields now always show the open in new inspector button.
  • SirenixEditorGUI.ObjectField has been marked obsolete, use SirenixEditorFields.UnityObjectField and SirenixEditorFields.PolymorphicObjectField instead.
  • DetailedInfoBox, no longer now toggles between the short and detailed descriptions, instead of extending the short description with the detailed description when expanded.
  • The ReadOnly and LabelText attribute can now also be applied to methods.
  • GetNiceName for MemberInfo's no longer adds spaces between uppercase and lowercase letters.
  • The LabelText attribute now also works on methods.
  • All Odin menu items have been moved to the Tools > Odin Inspector menu.
  • Groups with order priority 0 (IE, no priority defined) now inherit the order of the first member of the group, so that they will be placed more intuitively in the inspector.
  • PropertyContext<T> now has a private constructor, to prevent accident creation in drawers. Use PropertyContext<T>.Create() instead.
  • Removed this the background color shifting for Box and Tab groups as they interfered with other elements.
  • Renamed "Odin Preferences" window to "Sirenix Preferences".
  • TitleGroup no longer indents by default.
  • Removed the "Assets/Update Assembly Guids" menu item.

Additions

  • Added the "UseAsset" property to GlobalConfigAttribute, which lets a global config class specify whether an asset should be created for it or not.
  • Added support for decimal properties for Range attribute.
  • Added support for decimal properties for PropertyRange attribute.
  • Added missing documentation to PropertyRange attribute.
  • The InlineEditor attribute now has a MaxHeight property.
  • Added support for the following key types in dictionaries on prefab instances using the new extension system: Vector2, Vector3 and Vector4.
  • Added Sirenix.OdinInspector.Editor.OdinPrefabUtility class, which contains utilities for registering from user code that prefab instance values have been changed and should be persisted.
  • Added a max recursive draw depth setting, which stops properties from being drawn recursively past a certain depth, preventing Unity from freezing up if an accidental infinite depth draw loop is created.
  • Added SetCurrentPage to GUITabGroup, which switches directly to the specified page, with no animation.
  • DrawDefaultInspector on OdinEditors now also draw the editor using Odin.
  • Implemented Rect extensions for splitting a rect into a grid.
  • Implemented attribute drawer for Unity's ColorUsage attribute.
  • Added two methods named FindParent to InspectorProperty which recursively walks through all parent properties until a certain criterion is met.
  • Added option to DisplayAsString attribute, to enable or disable the string overflowing to multiple lines or not.
  • Added PaddingTop and PaddingBottom to VerticalGroup attribute.
  • Added UnitySerializationUtility.CreateDefaultUnityInitializedObject, which creates an object that is initialized with default values in the same way that default values are normally set by Unity.