Odin Inspector Version 1.0.6.1

Odin Menu Editor Window Improvements

We've added a lot of new features and made a few changes to OdinMenuTrees such as; filtering menu items, toggling their visibility, drawing a search field which works with keyboard menu navigation, automatically drawing a scroll view, and highlighting menu item etc...

With these new changes, OdinMenuTrees are now used for a wide range of features throughout Odin, such as the new Enum dropdowns and Odin Selectors.

  • Added OdinMenuTreeDrawingConfig to Odin Menu Trees, where you can enable and disable or enable various features of Odin Menu Trees when drawing them. Instances of these configs can be serialized separate from the Odin Menu Tree, and parsed to them, so that it keeps various settings through reloads, enabling search and undo etc.
  • Added AddRange to OdinMenuTree.
  • Added GetParentMenuItemsRecursive to OdinMenuItem.
  • Added a readonly LabelRect property to OdinMenuItems.
  • Added a lot new overloads in OdinMenuTreeExtensions for adding icons to menu items.
  • Added a DefaultToggleState boolean to OdinMenuItem.
  • MenuItemExtensions.AddThumbnailIcons can now also add thumbnail icons for menu trees containing types.
  • MenuItemExtensions.AddThumbnailIcons now also works with menu trees containing asset paths.
  • Instances of OdinMenuTrees can now be drawn by Odin.
  • Added support for referencing members using the $ sign in OdinMenuItem names.
  • SortMenuItemsByName now takes an overload to sort items with children by name before sorting menu items without children by name.

New Enum Dropdown

Added and replaced Unity's enum dropdown. You can still get the old enum drawer back in the Odin Inspector preferences window.

Odin Selectors

Odin Selector is a new class that combines Odin Editor Windows and OdinMenuTrees to draw feature-rich and flexible selector popups. OdinSelectors can be drawn anywhere; as a drop-down, in an EditorWindow, or inline directly in the inspector. We've included a few new selectors to start off with; EnumSelector, GenericSelector, and TypeSelector. These sort of popup are super easy to make yourself. Take a look at the documentation for OdinSelector's to learn more. We've also included a ScriptableObjectCreator which is located in the new sample project.




Odin Serialization Debugger

We've added a new tool for those utilizing Odin's serialization system, inheriting from classes such as SerializedMonoBehaviour or SerializedScriptableObject, that can help you get an overview of which members are serialized, and which are not.

The tool will tell you why a member is serialized by Unity, why it's serialized by Odin, or why it is not serialized at all. It will help you to debug your scripts, avoid common pitfalls, such as values not being serialized, not showing up in the inspector, disappearing between reloads or having both Unity and Odin serializing the same value.

When relevant, the window will also make good practices suggestions, so you can get the most out of using the Odin serializer.


Our First Sample Project

We've added our first sample project to Odin which is available from the getting started guide (The getting started guide can now also be found in Tool > Odin Inspector > Getting started). The intention of these sample projects is to give you inspiration, ideas, and tips and tricks to improve your workflow.

This time we've made an RPG editor that allows you to create characters, items, and edit inventories. This project showcases Odin Editor Windows, Odin Selectors, various attribute combinations, and custom drawers to build a feature-rich editor window for managing scriptable objects.

Additions

  • Implemented Odin property drawers and Odin serialization formatters for Vector2Int and Vector3Int.
  • Added a new attribute called DefaultSerializationBinder, that lets you help the DefaultSerializationBinder bind type names to types. This is useful if you're renaming a type, that would result in data loss, and what to specify the new type name to avoid loss of data.
  • Added a few more overloads OdinEditorWindow.InspectObjectInDropDown() which doesn't take a button rect, but instead opens the window at the mouse position.
  • Added a IsReadOnly property to the TableList attribute.
  • Added a menu item to open the getting started guid from Tools > Odin Inspector > Getting Started.
  • Added a readonly ObjectType property to StringMemberHelper.
  • Added DrawFoldoutTriangle to OdinMenuStyles.
  • Added ProgressBarField and overloads to SirenixEditorFields.
  • Added RectExtensions.AlignCenterX, AlignCenterY and AlignCenterXY to avoid confusion between RectExtensions.AlignCenter and RectExtensions.AlignMiddle.
  • Added ProgressBarField and SegmentedProgressBarField and overloads to SirenixEditorFields.
  • Added Serialization Debugger Example to the serialization related examples in the Odin Attributes Overview.
  • Added SirenixEditorGUI.DrawVerticalLineSeperator and SirenixEditorGUI.DrawHorizontalLineSeperator.
  • InlineEditors now has support for multi-selection.
  • Added SirenixGUIStyles.LeftAlignedCenteredLabel.
  • Added utility methods for making relative paths to PathUtilities.
  • Added an overview of Odin's included editor icons that can be found in Tools > Odin Inspector > Odin Editor Icons
  • Implemented support for left/right arrow keys on ProgressBarField and SegmentedProgressBarField.
  • Added a property to the ListDrawerSettings attribute that lets you override the default behaviour for adding objects to a list. If the referenced member returns the list type element, it will be called once per selected object. If the referenced method returns void, it will only be called once regardless of how many objects are selected.

Changes

  • Clicking buttons now also mark the underlying unity object(s) dirty. This means you no longer have to use EditorUtility.SetDirty, whenever you use a button attribute to change the state of an object. This behaviour can be disabled in the general drawer settings and is on by default.
  • AssemblyUtilities.GetTypeByCachedFullName now consistenly returns null if the type was not found.
  • Increased the priority of the HideLabel attribue drawer from (0.1, 0, 0) to (0.7, 0, 0).
  • Left and right arrow for navigating Odin menu trees, now behaves the same as Unity's project window.
  • Made menuTree.Selection.OnSelectionChanged obsolete, use menuTree.Selection.SelectionChanged instead which also gives you the type of event that occured.
  • Content padding in OdinEditorWindows is now applied after BeginDrawEditors instead of before, to make it easier to add toolbars to your editor windows.
  • OdinMenuItems.ChildMenuItems is now made virtual.
  • Moved EnsureOdinInspectorDefine.cs to Plugins/Sirenix/OdinInspector/Scripts/Editor/EnsureOdinInspectorDefine.cs so people manually can decide whether to include the define symbol. Also included instructions in the script to only have the ODIN_INSPECTOR symbol defined for those that have Odin. 289
  • EditorIcons.LockUnloacked is made obsolete. Use EditorIcons.LockUnlocked instead.
  • Replaced DirectoryInfoExtensions with PathUtilities.
  • Type drawer now uses the new TypeSelector.
  • OnValueChanged on members with structs in them will now always trigger when child values are changed, as changing a value in the struct counts as changing the struct itself.
  • CharDrawer no longer uses a delayed text field, which was confusing.
  • EditorOnlyModeConfig is now made public.
  • Improved logging in DeepReflection when the last member in the path does not match the expected type.
  • MemberInfoExtensions.IsStatic should now support all cases.
  • ReferenceEqualityComparer.GetHashCode() now returns -1 instead of throwing an exception, if the given object instance's own GetHashCode() throws a NullReferenceException.

Major Fixes

  • Fixed a bug where a mysterious "Serializable Json Dictionary" property would show up in OdinEditorWindow in some of the 2017 Unity versions.
  • Fixed a bug where the UnityEvents would behave badly if multiple UnityEvents was being drawn. 294, 284
  • Fixed a crash-bug reagrding Odin serialized UnityEvents and prefab modifications. 280, 291
  • In some rare cases, prefab instances can become corrupted if there somehow end up being applied bad prefab modifications to the JSON, Nodes or Binary data fields. This will result in a corrupted data-stream, and if the resilient serialization mode fails to be resilient, scenes will also give an error when opened or built. And in some cases would also cause an VS Bridge error when trying to log an error.
  • Fixed an issue where the persistent context cache would not be saved when exiting play mode, resulting in foldout groups expanding or collapsing etc...
  • Fixed an issue where changing a property in the inspector would in some cases not always mark the object dirty and repaint the scene view.

Fixes

  • Fixed an issue where dragging from one list to another sometimes would cause the object to be copied instead of moved. 295
  • DragAndDropUtilities.GetDragAndDropId now gets a more reliable Id, which is immune to damages made to GUIUtility.GetControlId.
  • Fixed a bug where AOTGenerationConfig.ScanProject would throw an exception when executed from command line. 282
  • Fixed a bug where DontApplyToListElements attribute would sometimes incorrectly think that a property was part of a list element. 279
  • Fixed a bug where adding an icon to an OdinMenuItem would not assign the icon to the selected menu item state.
  • Fixed a bug where it was possible to set a progress bar to a value that was outside the specified range.
  • Changing a value inside a struct with multiple elements selected no longer sets the entire struct to be the same on all selected instances.
  • Fixed a bug where the delegate drawer would be indented twice per indent level if no label was assigned.
  • Fixed a bug where the PreviewField attribute where not applied to list elements.
  • Fixed an issue in SerializationPolicies where Unity and Strict policies would return true for non-auto properties.
  • Fixed an issue where inheriting from OdinEditor, overriding OnInspectorGUI and calling DrawDefaultInspector would result in an endless recursive loop.
  • Fixed an issue with File and Folder fields that would not make correct relative paths on Mac.
  • Labels are now always fully visible in the Odin preferences window.
  • ProgressBarField and SegmentedProgressBarField now works with keyboard focus.
  • StringExtensions.SplitPascalCase now doesn't break if the first letter is a non-letter, and doesn't break with empty strings either.
  • When the OdinMenuEditorWindow automatically selects the first menu item that has something to display, it now also expands all parent menu items, which will make the selected menu items visible.
  • Changes made to struct instances inside OnValueChanged callbacks are now kept and applied, rather than discarded.
  • Fixed an issue where buttons in TableLists would spam the console with GUIContent null warnings.
  • Fixed an issue where TableLists would throw OutOfRangeExceptions when the title label was null. 273
  • Fixed a case where FormatterEmitter could fail to emit a formatter for a type if it had already emitted a formatter for another type with the same full name.
  • Fixed an error in the serialization system's JsonTextReader class, where it would guess that an unannotated, nameless entry with the string content "null" was an Integer entry, rather than a Null entry.
  • Fixed a minor issue in ToggleExamples where not all of the examples where being drawn as intended.
  • Fixed potential stack overflow in TypeExtensions.AreGenericParametersFulfilledBy, when a generic parameter has a constraint that contained itself, such as "where T : IComparable<T>".
  • Fixed serialization error where System.Runtime.Serialization.IDeserializationCallback.OnDeserialization would be called on callback instances before values were deserialized into the given instance, not after, causing errors in some cases.
  • The SerializableFormatter class now also finds ISerializable constructors defined in the serialized type's base classes.
  • TypeExtensions.GetAllMembers<T> no longer throws a null exception if it is passed System.Object as a parameter.
  • Fixed right click context menus for Folder/FilePath fields.

What's to come

We wanted to take the opportunity to tell you a bit about the future of Odin Inspector. As some of you are aware, we recently pitched, that the next patch - 1.0.7 - would bring improvements to the validation system included in Odin. But due to the strong interest in the features of Odin 1.1 we've decided to put 1.0.7 on hold for now, and go straight to 1.1, which we have been working on for quite some time and will start beta-testing of very soon.

In Odin Inspector patch 1.1, we've completely rewritten how the property tree works internally. Properties are now lazily evaluated, which means that Odin doesn't care how much data you throw at it, it will only do processing on the properties you're looking at, which is currently not the case. This will vastly increase editor performance.

It will also introduce attribute and property resolvers and locators. Much more on that later, but this means that attributes and properties can come from anywhere. This will open up a world of new possibilities! You'll be able to add attributes to members you don't own the code for, you would be able to put all attributes on the types and have them be applied globally for all members of that type, ShowInInspector will work on static members as well. We could even at some point, go as far as to create an editor to make editors, meaning you wouldn't even have to put attributes on your members, you could just right-click a property in the inspector, and customize it. Adjust the range slider, drag and drop them around to change the order etc...

You can sign up for beta testing by sending us a mail with your Odin invoice Id included from our contact form.


Odin Inspector Version 1.0.6.0

Upgrade / Install Notes

We've implemented a new getting started guide to help you get going. It will pop-up automatically when you first import Odin. The wizard itself is a scriptable object located in the Plugins/Sirenix/ folder if you want to find it again at a later time.

  • We've implemented a new Odin Upgrader that will make your update experience to 1.0.6.0 straightforward and painless. It will delete files that are no longer being used, and delete it self once it is done.

  • Icons are now embedded in the source-code, which means there is no longer a sprite-sheet filled with icons that annoys you in Unity's asset selector window.

  • All demos are now located in separate Unity packages, which needs to be imported. This can be easily achieved in the new getting started wizard, which gives you an overview of all availble demos.

    This was done so we more easily can modify and add demos over time, without cluttering up your project with unnecessary code. This window will pop up when you Import Odin.

  • Unity 2018.1 Support

    Changes in the new Unity version broke a few things in Odin, but this has been addressed and Odin now officially supports Unity 2018.1.

  • Odin Editor Windows

    The long awaited editor window features are finally here!

    • You can now use Odin to rapidly create custom Editor Windows to help organize your project and game data. Make sure to check out the examples!

    • Inherit from OdinEditorWindow instead of EditorWindow. This will enable you to render fields, properties and methods and make editor windows using attributes, without writing any custom editor code. This features was also there before, but it is now drastically improved.

    • Odin Editor Windows are not limited to drawing themselves; you can override GetTarget() or GetTargets() to make them display scriptable objects, components or any arbitrary types (except value types like structs).

    • Derive from OdinMenuEditorWindow to create windows that inspect a custom tree of target objects, with automatic support for multiselection and more. These are great for organizing your project neatly, and escaping the confusing, massive project view hierarchy that often exists in very large projects. For example, Odin itself uses one of these to draw its preferences window.

    • You can call OdinEditorWindow.InspectObject(myObj) to quickly pop up an editor window for any given object. This is a great way to quickly debug objects or make custom editor windows on the spot!

  • Object Field Enhancements

    Clicking the inspect object pen opens a new inspector window for you right where you need it. Now you can also right click the pen, to open a pop-up style inspector that will close itself when it loses focus.

  • Organized Attributes Overview

    We have a lot of attributes by now, and it was getting hard to find the examples you needed in the attributes demo overview scene. We've organized the scene to provide a better overview.

  • Referencing members using the $ sign in attributes such as LabelText, Title, FoldoutGroup etc. is no longer restricted to only members that return a string. ToString() is now used on non-string values.

New Attributes

  • Added a new PreviewField attribute that draws the assigned object with a preview.
    • Hold Ctrl + Click = Delete Instance
    • Drag and drop = Move / Swap.
    • Ctrl + Drag = Replace.
    • Ctrl + drag and drop = Move and override.
    You can customize the default behaviour of the PreviewField attribute in Odin's preferences window.
  • Added a new EnumPaging attribute that draws an enum with next and previous buttons, so you can quickly change the selected value.

Changes

  • Deleted the Placeable Objects Demo, as it was slightly off-topic for Odin, and some people were misunderstanding its purpose and actually using it as an object placer, which was never intended to be an actual supported "feature" included in Odin. We will eventually add a new, better demo that fulfills the same purpose without causing such confusion.
  • Both FilePath and FolderPath attributes should now have much more consistent behaviour.
  • Deleted Readme.txt which is replaced with the new getting started wizard.
  • Removed varius APIs that have been marked obsolete for a while.
  • Sprite members are now drawn in the same way as Unity regularly does it. Use the new [PreviewField] attribute to get a thumbnail-style preview.
  • You can now create instances of all non-abstract types using the instance creator dropdown window. Types with no default constructors will be instantiated without any constructors being called, using FormatterServices.GetUninitializedObject.
  • Made the documentation for the ShowInInspector attribute more clear about the attribute not causing anything to be serialized.
  • Removed unessesary null check in EnumDrawer.
  • Giving StringMemberHelper a $ without a name will now return the name of the instance instead of giving errors.
  • Made SirenixEditorConfigAttribute, EditorGlobalConfigAttribute obsolete in favor of the new Odin Editor Windows.
  • Increased the default animation speed of Tabs.
  • The "Open in new inspector" pen icon drawn next to object-fields are now drawn inside the object fields instead.
  • ValueDropDownItem is now a struct instead of a class.
  • ValueDropDowns no longer automatically change the value when an invalid value is present. Bitbucket issue 251
  • Renamed AssemblyUtilities.GetType to AssemblyUtilities.GetTypeByCachedFullName, to indicate what the method actually does.
  • Fix a bug where the overflow property in DisplayAsString would have the opposite effect.
  • Tables now automatically adjust label widths inside columns. This fixes those issues where the content of columns would extend beyond the column width.
  • Tweaks to HideIf attribute documentation.
  • Odin editors now always request a repaint on mouse move to get persistent mouse over effects.
  • Embedded all icon sprite data into Sirenix.OdinInspector.Editor.dll - The icon sprite sheet is no longer being used, and will be deleted when you upgrade. This also enabled us to fix some issues where icons would be rendered too darkly when the project was using linear color space.
  • Made som changes to TextureUtilities.
  • Decreased the depth limit in UnitySerializationUtility.CreateDefaultUnityInitializedObject, so that Unity-serialized cycles will result in less objects being inadvertently created.
  • Improved UI graphics for EnumToggleButtons, Lists, Dictionaries, AssetList etc..
  • List elements are now only draggable via the drag handle. Bitbucket issue 257
  • Made UnityEditorEventUtility public
  • ExcludeDataFromInspectorAttribute is now marked Obsolete. Unity's HideInInspector attribute now also results in the property being entirely excluded from the property tree.
  • Reference Drawer now gives you a simpler reference path name.
  • Specifying negative values in LabelWidth now subtracts from the current label width, instead of doing nothing.
  • Changed various type lookups across Odin, that were earlier using AssemblyUtilities.GetType (now AssemblyUtilities.GetTypeByCachedFullName) in situations where that lookup might fail.

Minor Additions

  • Added Unity Folder icon to EditorIcons
  • Added Eye Dropper icon to EditorIcons
  • Added Odin Inspector Logo to EditorIcons
  • Added Pause icon to EditorIcons
  • Added FilePathField to SirenixEditorFields
  • Added FolderPathField to SirenixEditorFields
  • Added two new Dropdown overloads to SirenixEditorFields
  • Added ShowInInlineEditors attribute to match HideInInlineEditors
  • Added parameterless constructor to the VerticalGroup attribute
  • Added allowSceneObjects overloads to DragAndDropUtilities.

Fixes

  • Fixed a bug in serialization that was introduced in patch 1.0.5.3, that would cause all but the first serialized dictionary with the same comparer instance to become null upon deserialization. This fix is backwards compatible with dictionary data saved both before and in patch 1.0.5.3 - all dictionary data will be deserialized properly, regardless of the nature of the saved comparer data. We apologize deeply for this inconvenience, and promise to do better in the future.

  • Odin now correctly guesses that Unity will not serialize lists of lists and arrays of lists.
  • Odin now correctly guesses that Unity will not serialize types derived from List<T>.
  • Odin now correctly guesses that Unity will not serialize [Serializable] classes and structs defined in mscorlib, unless they are primitives, enums or strings.
  • Fixed issue where an unexpected serialized boxed primitive type would cause a serialization exception when being eligible to be cast to an expected member type with an implicit or explicit cast operator defined for the primitive type, causing the value to be lost instead of cast to the expected type.
  • Fixed possible infinite recursion when correcting Unity-serialized null values, and encountering recursion of a serialized type (prompting Unity's infinite depth serialization limit errors to also appear). Odin now detects this recursion as it happens, and aborts null value correction while displaying an appropriate error message.
  • Fixed error where Odin's inspector system mistakenly always had properties inherit the serialization backend of the parent property, causing non-serialized nested members to be mistakenly marked with the same serialization backend as their serialized root members. This accidentally caused prefab modifications to be registered for non-serialized members, when those members were nested in Odin-serialized root members.
  • Fixed error where value entries representing Unity-serialized UnityEngine.Object references would never update on UnityEngine.Object polymorphism, and thus would fail to find the exact, correct drawers in case of said polymorphism.
  • Fixed issue where colors drawn with the [ColorUsage] attribute on them would still use Unity's own Color copy paste, which would not work correctly with Odin. Odin now blocks Unity's copy paste dropdown on colors drawn with [ColorUsage]. For those who once used [DrawWithUnity] to make the [ColorUsage] attribute work, they can now remove that attribute, as Odin's ColorUsageDrawer now works fine.
  • Color32's right-click context menu now works.
  • Color and Color32 values can now be copy pasted into each other and will work correctly.
  • Added ColorUsage32AttributeDrawer, which makes the ColorUsage attribute also work on Color32 values.
  • Fixed a bug where the FolderPath attribute sometimes would throw errors while dragging non asset unity objects.
  • Fixed an issue where FolderPath attribute would throw a null reference exception when clicking the select folder button, when a parent path was specified. Bitbucket issue 262.
  • Fixed issues with FolderPath and FilePath attributes would not always open the correct folder. Bitbucket 238.
  • Fixed an issue where the open folder button could not be clicked when the field was disabled.
  • Fixed a bug where Odin was rendering the Object thumbnail field pen icon over regular non-thumbnail object fields sometimes.
  • Fixed a bug where DisplayAsString didn't respect indent levels when label was hidden.
  • Fixed a bug where the ProgressBar allocating unnecessary horizontal space when no label was being drawn.
  • Fixed a bug where dragging files or folders from the project window to a member with the FolderPath attribute had no effect.
  • Fixed a bug with InfoBox and DetailedInfoBox where the changing the IsVisible state would sometimes show an error in the console.
  • Fixed case where Dictionary value/key rendering for the add key area would not render properly if key or value were of a type that might be serialized by Unity.
  • Horizontal groups no longer flicker in the first frame if there is no width defined as percentage. The amount of flicker is also reduced if only one percentage is defined.
  • Fixed a bug where drag and drop of unity-type objects in two-dimentional tables didn't work.
  • Fixed a bug where StringMemberHelper would cause errors if used outside Unity's GUI context.
  • Fixed issue where Unity would not mark ScriptableObjects dirty when Undo changes and modifications were recorded on them. This was causing value changes triggered indirectly by things such as buttons being clicked to not be registered, and not mark the object dirty properly.
  • Fixed a bug where GUIHelper.PushHierachyMode would push the wrong label width.
  • Fixed a bug in EmitUtilities where CreateStaticPropertyGetter forgot to box the return value when the property is a value type, and T is of type object.
  • Fixed a few potential bugs in DragAndDropUtilities, and added DragAndDropUtilities.IsDragging
  • Fixed a bug where various fields in SirenixEditorFields would have an uncessesarry minimum horizontal width when no label was provided.
  • Fixed a bug where a null reference exception could be thrown in SirenixEditorFields.Dropdow<T>.
  • Simplified RectExtensions.Split and made it no longer cast values to ints, which in turn also fixed a lot of UI flickering issues that were especially noticeable when resizing windows.
  • DragAndDrop utilities now respects EditorGUI.showMixedValue.
  • Pushing and popping the HierachyMode via GUIHelper now properly preserves the LabelWidth - This fixes the label width issues with tab groups.
  • Fixed issue where a non-flag enum dropdown would not display the selected value.
  • Fixed a bug in newer Unity versions where LazyEditorIcon was unable to find the type UnityEngine.ImageConversion, and was therefore unable to load icon images.
  • TypeExtensions.GetAllMembers now only returns members declared on the given type when IsDeclaredOnly is used.
  • The Show Index Labels option in the General drawer preferences is now persisted properly, and no longer resets to the default value upon reload.
  • Fixed case where default field initializer values in classes would become lost when adding elements to lists and arrays of those classes.
  • Fixed bug where System.Tuple support would break on Unity 2017.2 and up, because for some reason the System.Tuple implementation and interface naming scheme changed from 2017.1.
  • UnityEvents and custom UnityEvent types (that are marked serializable) can now be drawn anywhere, in any context, even when not serialized by Unity.
  • When Odin is drawing within a GUI.Window, it will no longer randomly lose its focus. This bug was fixed by replacing all GUI.FocusControl(null) calls with the new method called GUIHelper.RemoveFocusControl()
  • Fixed a bug where the instance creater window would list unassignable types. Bitbucket issue 249.