Odin Inspector Version 1.0.4.0

Upgrade notes

  • Delete the Sirenix/Demos folder before upgrading, as we have deleted a demo script that is now obsolete.

Known issues

  • A bug managed to sneak into this patch, but a hotfix (1.0.4.1) is already submitted and should come out promptly. When a scene is loaded, or the editor does a script reload, you may get errors about Application.get_dataPath being illegal to access during serialization. Be careful with saving your scene after this happens - just reload the scene by double-clicking it in the project view, and the scene's data should be reloaded properly.
  • A bug in Unity 2017.1 and 2017.2 means that users on those versions may experience a crash when upgrading, and random crashes whenever they are renaming scripts or moving scripts around the project. When this happens, going into the folder structure and deleting GeneratedOdinEditors.dll will in the vast majority of cases fix the issue. This bug has been fixed by Unity in beta version 2017.2.0b3, and the fix should be backported to 2017.1 soon.

Highlights

  • Added a new attribute called InlineProperty which can be applied to classes, structs and members. Instead of drawing the value in a foldout, Odin will draw the label to the left and its inner content to the right.
  • Added a new attribute Called LabelWidth which changes the width of the label.
  • Deprecated the ShowForPrefabOnly and EnableForPrefabOnly attributes and added 8 new prefab related attributes which gives you much more control.
    • Added a new attribute called DisableInPrefabs which disables a property if it is drawn from a prefab asset or a prefab instance.
    • Added a new attribute called HideInPrefabs which hides a property if it is drawn from a prefab instance or a prefab asset.
    • Added a new attribute called HideInPrefabInstances which hides a property if it is drawn from a prefab instance.
    • Added a new attribute called HideInPrefabAssets which hides a property if it is drawn from a prefab asset.
    • Added a new attribute called HideInNonPrefabs which hides a property if it is drawn from a non prefab instance or asset.
    • Added a new attribute called DisableInPrefabInstances which disables a property if it is drawn from a prefab instance.
    • Added a new attribute called DisableInPrefabAssets which disables a property if it is drawn from a prefab asset.
    • Added a new attribute called DisableInNonPrefabs which disables a property if it is drawn from a non-prefab asset or instance.
  • Added a new attribute called HideInInlineEditors which hides a property if it is drawn within an InlineEditorAttribute.
  • Completely revamped the [ValidateInput] attribute. It can now detect changes to child values, as well as customize the error message and type - see the updated demo example. Additionally, it now also runs validation when an undo or redo is performed. Finally, support for preventing/rejecting invalid value changes has been removed from [ValidateInput], as it did not work correctly before in many cases, and proved infeasible to implement properly.
  • Upgrades to HorizontalGroup
    • Added PaddinLeft, PaddingRight, MinWidth and MaxWidth properties.
    • All properties now supports percentage. This includes Width, Min and Max Width, Padding and Margin. Values between 0 and 1 will be treated as percentage, 0 = ignored, otherwise pixels.
    • All properties are no longer private set.
    • Fixed an issue where horizontal groups start out too wide and slowly becomes the right size over time as the inspector window updates.
    • HorizontalGroup no longer sets the label width based on the width of the columns. This means that you can now do stuff like this: (and still maintain a proper label width which you couldn't do before).

Fixes

  • Fixed bug where Color and Color32 couldn't be properly copy pasted.
  • Unity's own context menu for Color and Color32 fields no longer shows up when the field is right-clicked.
  • Fixed issue where references to members with [HideInInspector] on them would not be drawn when the reference is expanded.
  • Fixed case where strings and boxed enums that were exact the same object instance would count as references to each other in the inspector.
  • Fixed rare error where changing a value's type between two different strongly typed list types would cause internal errors in the property system when updating a property's chlidren.
  • Fixed error where [ValueDropdown] wouldn't work properly with polymorphism.
  • Fixed error where [ValueDropdown] wouldn't work on list elements.
  • Fixed various errors with flag enums causing invalid cast exceptions. These should no longer happen, regardless of the enum's values and underlying type.
  • Fixed issue in DeepReflection with invalid IL code being emitted for invoking methods on value type instances. This was causing various attributes such as ShowIf and HideIf to throw exceptions when used in structs and referring to property and method members.
  • Fixed case where dictionaries that were referenced polymorphically would cause the inspector to break.
  • Fixed a lot of GUI Spaceing issues.
  • InfoBoxes now also work on methods.
  • Fixed issue, where int fields couldn't be changed with sliding, if mouse movement was too slow.
  • Fixed possible compiler error when compiling to iOS on xcode.
  • Fixed invalid generic argument exceptions being caused by enum serialization on the new .NET 4.6 scripting backend.
  • Fixed bug on the new 4.6 experimental scripting runtime where emitting a serialization formatter for an empty type with no values to serialize would cause Unity to crash, due to incorrect parsing of the emitted empty IL code.
  • Fixed compiler errors in new group system source code when using Unity's old compiler.
  • Fixed rare case where a missing editor type could cause compiler errors when generating editors.
  • MemberFinder now correctly includes the requested method parameters in the error message when it fails to find a member.

Changes

  • Lowered most error logs in DelegateFormatter to warning level, as many of them can occur in perfectly legitimate situations.
  • All members marked with [HideInInspector] now have a default property order value of int.MaxValue, by default placing them last in the order of properties. This ensures that it is only in very rare cases that there will be references to members that are hidden.
  • Enum flag names in the flag dropdown now have nicified names.
  • OdinEditorWindow now implements a scroll-view, and ensure the window is repainted when needed. A bit of padding around the drawn content has also been added.
  • DefaultSerializationBinder now also tries to resolve type names using AssemblyUtilities.GetType.
  • Slightly altered the sensitivity of field sliding to be a bit higher around a value of 0.
  • Updated Demo Scene and Documentation.
  • Improved error messages received when incorrectly applying the [ShowOdinSerializedPropertiesInInspector] attribute to classes that are not specially serialized and do not support special prefab serialization.
  • Property labels in tab groups now align with labels outside of tab groups.
  • Changed InfoBoxAttributeDrawer's priority to (0, 10001, 0)
  • Changed SpaceAttributeDrawer's priority to (1.1, 0, 0)

Additions

  • Added a very rudimentary Delegate drawer.
  • Odin now correctly guesses that fixed size buffers are serialized by Unity in version 2017.1 and up.
  • Added RectExtensions.ExpandTo.
  • Added new constructor to [OnInspectorGUI] that lets you specify two methods to invoke: a method to prepend, and a method to append.
  • Added support to Odin for drawing types derived from NetworkBehaviour, and added the SerializedNetworkBehaviour type. Note that [SyncVar] and SyncLists still have the exact same limitations as before, regardless of whether Odin is serializing the type or not.
  • The HideIf and Showif attributes now have an options to disable the fade in and fade out animations.
  • The DictionaryDrawerSettings attribute now has an option to marke a dictionary ReadOnly as well as changing the labels for the Key and Value columns.
  • Added a TextureUtilities class containing static helper functions.
  • Added support for injecting GUI before and after each element is drawin inside a list. This is achived using the [ListDrawerSettingsAttribute(OnBeginListElementGUI = "OnBeginListElementGUIMethodName", OnEndListElementGUI = "OnEndListElementGUIMethodName")].
  • Added support to the ListDrawerSettings attribute for defining custom label text for each list element. This is achived using the [ListDrawerSettingsAttribute(ListElementLabelName = "ListElementLabelName")].
  • Added PropertyTree.OnUndoRedoPerformed