Odin Inspector Version 2.1.0

Making sure everyone on your team sets up your data correctly when working directly with assets is made easy using the live input validation features that Odin Inspector provides. However, sometimes, warning messages get ignored, assets get deleted, requirements change, and data is made obsolete as your project grows. Slowly bugs, errors, and faulty data creep in as work progresses. Manually going through your entire project to find and correct issues can quickly grow to be an insurmountable task.

Using the Odin Project Validator, you can easily scan your entire project for warnings and errors, and fix them inline right from the validator. The validator handles scene switching and saving as you work, letting you quickly and freely navigate between all issues with no hassle and no delay.

Learn more here

New tutorials, documentation and attribute overview

Our new website has brand new searchable tutorial, documentation and attribute overview sections - check them out and learn how you can get the most out of Odin already today!

Tutorials   Attribute Overview   Documentation

Community tools

Check out our new community tools page to see all the neat things people have built with Odin and made available to the community. Create an account to submit your own tools!

Learn more here

Please note: source code is now a separate pre-configured and easy-to-use package that you can download from our website, but the source code is no longer included in the core Odin Inspector package sold here and on the Asset Store.

Everyone who has purchased Odin Inspector before the 2.1 beta started (28.05.2019) will receive the source code and Odin Project Validator addons for FREE, starting now we will be selling the source code as a separate paid package.

New Odin Inspector 2.1 Features

Expressions

Start your string with an '@' sign, and write C# directly in your attribute declaration; this works in almost all attributes that take a string. This reduces boilerplate code and introduces countless new possibilities.

Learn more here

Interactive Attributes Overview Window

You no longer need to import the demo scene; all attribute examples are now available in a window: Tools > Odin Inspector > Attributes Overview

Also see our new online attributes overview

New AssetSelector attribute

A new, simpler alternative to the AssetList attribute, the AssetSelector attribute prepends a small button next to the object field that will present the user with a customizable hierarchical dropdown of selectable assets.

Learn more here

New ChildGameObjectsOnly attribute

Avoid having to manually locate the desired object in the hierarchy, while at the same time telling your designer how your component should be used!

Learn more here

New ShowIfGroup and HideIfGroup attributes

ShowIfGroup and HideIfGroup are group attributes that allow for showing or hiding a group of properties based on a condition. They can be combined with other group attributes using group paths, and can be used this way to show or hide groups of any kind.

See ShowIfGroup examples   See HideIfGroup examples

New validation backend

Before, Odin had separate drawers for attributes such as the Required, ValidateInput and AssetsOnly attributes. Now, all of these have been turned into standalone Validators, and are drawn in the inspector by a single drawer that integrates the new validation system.

This means that you can now easily define your own validators. Errors and warnings will then automatically show up in the inspector. Furthermore, the new validation system is completely separate from the drawer system. This means that you can manually invoke the new, straight-forward validation API from anywhere to integrate project validation in your own custom workflow and build pipelines.

You can make your own AttributeValidators and ValueValidators. Below is a simple example of how you could create a validator that would display an error in the inspector if a texture too large for your game is used.

[assembly: RegisterValidator(typeof(TextureSizeValidator<>))]

public class TextureSizeValidator<T> : ValueValidator<T>
  where T : Texture
{
  protected override void Validate(T value, ValidationResult result)
  {
    if (value && value.width > 1024 && value.height > 1024)
    {
      result.Message = "We're making a mobile game for crying out loud!";
      result.ResultType = ValidationResultType.Error;
    }
  }
}

Your custom validators will also be integrated in the new Odin Project Validator.

More examples and tutorials will be added soon.

Performance Improvements

  • Odin now triggers far fewer serialization calls per frame, vastly improving performance when inspecting data-heavy objects.
  • Odin now caches property path lookups, resulting in far less time spent parsing property paths.

Additions

  • Type entries in the AOT Generation Config window as well as Type members drawn in the inspector can now parse type names written in the style of C# identifiers, IE, writing "Dictionary<int, string>" will now work.
  • Added GUIHelper.PingObject which is a more feature rich version of Unity's PingObject.
  • Added GUIHelper.SelectObject.
  • Added IfAttributeHelper class which allows for easy implementations of If style attributes.
  • Added OdinMenuTree.Selection.SelectedValue and SelectedValues.
  • Odin Selectors now displays an infobox if the selector doesn't contain any items.
  • RectExtensions.AlignCenterXY(this Rect rect, float width, float height).
  • Added ability to provide a member/expression string to the [MinValue] and [MaxValue] attributes.
  • Added HideTabGroupIfTabGroupOnlyHasOneTab to the TabGroup attribute.
  • Added MemberFinder.HasConvertableReturnType, which requires only that it is possible to convert the return type to a given type using the new ConvertUtility.
  • Added the ConvertUtility class, to provide weakly typed conversion and casting that takes all factors, declared cast operators, and possible conversions into consideration.
  • Added the GenericNumberUtility class, which provides some weakly typed number comprehension utilities.

Changes

  • Added deprecation warning to all Odin-serialized prefabs in 2018.3 and above.
  • All If- attribute drawers now use the new IfAttributeHelper class, instead of relying on PropertyContext lookups.
  • Group attributes, specifically the base PropertyGroupAttribute no longer has the JetBrains.Annotations.MeansImplicitUse attribute.
  • Removed attributes overview card from the Getting Started window, and replaced it a button to open the Attributes Overview window.
  • Removed attributes overview scene.
  • Renamed TypeInfoBoxAttributePropertyProcessorProcessor to TypeInfoBoxPropertyProcessor because was running into errors due to long path length.
  • ValueDropdownAttributeDrawer no longer invokes the referenced member twice when getting the value.
  • Dragging a value on top of a closed list now appends the value to the end of the list instead of the front.
  • Almost all of Odin's attributes can now be applied anywhere and are no longer restricted to only a subset of possible attribute application targets.
  • Changed "MISSING" text for type entries in the AOT generation config to "INVALID" to be clearer about the fact that it will do nothing.
  • InspectorProperty.Update() now returns a bool, indicating whether an update was performed or not.
  • Moved FastTypeComparer from Sirenix.OdinInspector.Editor to Sirenix.Utilities.Editor assembly.
  • Moved MemberFinder from Sirenix.Utilities to Sirenix.Utilities.Editor assembly.
  • Removed the Sirenix.Utilities.Editor.CodeGeneration namespace and all types therein, as they were an unused remnant of old systems that have since been replaced. If you were using it, you can extract the types from old versions of the source code and continue using them as you please.

Fixes

  • Fixed an issue where the effect of the TypeFilter would in some cases not be cleared and hence applied to other properties.
  • Fixed a crash when using DeepReflection on const fields.
  • Fixed divide by zero exception in RectExtensions.SplitGrid.
  • Fixed issue in 2018.3 where changing a PreviewField with the Unity object picker would sometimes change other preview fields as well.
  • Fixed a typo in FolderPath attribute drawer.
  • If an enum has a None value with [HideInInspector] on it, a new None value will no longer be injected by EnumSelector<T>.
  • Odin's default property member selection logic in InspectorPropertyInfoUtility will now always ignore properties that have index parameters.
  • TypeExtensions.GetCastMethod now also searches parent types for valid methods.
  • TypeExtensions.GetOperatorMethod and TypeExtensions.GetOperatorMethods now also search parent classes for valid operators.
  • A property's children are now disposed immediately when the property enters a value state that does not allow having children (null, reference, value conflicts).
  • AssetUtilities.GetAllAssetsOfTypeWithProgress now correctly handles cases where types with the same name exist in multiple different namespaces. #542.
  • Collection resolvers can now correctly handle the case of being asked about their child count, when the inspected collection is null.
  • Corrected spelling of ValidateInputAttribute.ContiniousValidationCheck to ContinuousValidationCheck and obsoleted the old member as a wrapping property.
  • Fixed a bug where the AssetSelector attribute would cause errors when used on components.
  • Fixed a bug where the ChildGameObjectsOnly attribute didn't work on list elements.
  • Fixed a bug where the ChildGameObjectsOnly attribute didn't work on list elements.
  • Fixed a bug where the MinMaxSlider attribute would clamp the values while you where entering numbers in the fields.
  • Fixed bug where a ColorBlock being drawn by the Unity PropertyDrawer legacy support system would cause an exception to be thrown any time a color value in the block is changed.
  • Fixed various places in the code where InspectorProperty.Info.GetAttribute<T>() method was being used instead of the more correct InspectorProperty.GetAttribute<T>() method. This was causing some attributes to not register correctly some places when added through a self property attribute processor.
  • Odin now uses PropertyHandler.GetHeight() to calculate the height for legacy Unity property drawers (when available), for its Unity property drawer backwards compatibility system. This means that property drawers which call EditorGUI.GetPropertyHeight() with their own property in a PropertyDrawer.GetPropertyHeight() override to calculate their drawing height, will no longer see a duplicate recursive call to PropertyDrawer.GetPropertyHeight() from that call, and they will be calculating the correct property height.
  • Properties returned by path through the PropertyTree path lookup methods GetPropertyAtPath, GetPropertyAtUnityPath and GetPropertyAtPrefabModificationPath are now always guaranteed to be reachable from the tree root - before, the newly introduced path-to-property cache might return invalid properties that were no longer reachable from the tree root.
  • Removed all API calls that were causing the assembly updater to need to run during import. This should fix Unity 2019.3 crashing during import of Odin, and should also mean that the assembly updater no longer asks to upgrade Odin assemblies during import.
  • Removed all references to the UnityEngine.UI assembly. Old functionality that used UnityEngine.UI is now weakly typed by reflection, and conditional on the assembly being loaded by Unity.
  • Setting a new value to a dictionary on a prefab instance now correctly sets the value that was constructed before adding, instead of default(TKey) - this fixes a regression that was likely introduced somewhere in between 2.0.10 and 2.0.20.
  • ValueDropdown now updates cached value names when the dropdown is opened; this means the label on the dropdown will now reflect the last collection passed to the dropdown.

Beta fixes

  • Fixed case where a validation scan would error when recursively validating a type which implemented only ICollection<T> but not ICollection or another other common collection interfaces.
  • Fixed a bug were the opening the Odin Project Validator window would undock it if it was already docked instead of focusing it.
  • Fixed issue where validation overview would break if any validator threw an exception the first time it ran.
  • The scene setup will now be properly restored when a scene validation profile is cancelled mid-validation.