Compatibility with Odin Inspector

  07. Compatibility No Comments

Odin - Inspector and Serializer

If you are an Odin Inspector user, you will be able to hold on to the Odin experience you have gotten used to inside Power Inspector. You can combine the best of both words; Odin’s comprehensive attribute drawer collection being drawn inside Power Inspector, where you have your back and forward buttons, a search box, split view, Debug Mode+ and more to boost your workflow.

To use the two of them together you must make a decision about which one of them will handle drawing the class members of targets within the inspector view.

For all types where you are using Odin Inspector’s inspector-related attributes, you will probably want to let Odin Inspector handle the drawing, since otherwise the attributes won’t have any effect inside Power Inspector (with the exception of ShowInInspector).
This is because Odin Inspector doesn’t utilize PropertyDrawers to handle it’s attribute enhancements, but has a custom system, meaning that it is not possible to slip in Odin Inspector’s attribute-based changes at the field level to Power Inspector.

For types where you are not using Odin Inspector’s inspector-related attributes, you can let Power Inspector handle the drawing if you want. However if you would like to let Odin Inspector handle drawing all class members, that is also totally possible.

If you only want to use Odin Inspector’s serialization system, but don’t need to use any of the attributes or custom drawers that Odin Inspector offers, then you can let Power Inspector handle the drawing of all Unity Objects.

Which Drawer Should I Use By Default?

The best way to figure this out is to try them both out for yourself and see which one you like better!

When using Power Inspector you get things like enhanced keyboard support and an enhanced Object reference field, but Odin Inspector has its own set of enhancements it offers as well.

Having Power Inspector Draw All Class Members

To make Power Inspector draw all class members set the preference item Use Editors Over Drawers to Only If Has Custom Editor.

Having Odin Inspector Draw All Class Members

To make Power Inspector draw all class members set the preference item Use Editors Over Drawers to Based On Plug-ins or Always.

Selecting Drawer For Each Type

If you set the preference item Use Editors Over Drawers set to Based On Plug-in Preferences (the default setting), then you will be able to control exactly which types are drawn by which plug-in.

You can configure the drawer for each type using the Preferences window in Odin Inspector.

  1. Select Edit > Preferences.
  2. Select the Odin Inspector view and click the Show Odin Preferences button.
  3. Select the Editor Types view.
  4. Make sure that Enable Odin In Inspector is enabled.
  5. In the Draw Odin for list select all the types for which you would like Odin Inspector to handle the drawing. Power Inspector will handle drawing for all the remaining types.

On Script Organization

Since the types listed in the Editor Types view are organized by namespace, using your namespaces to separate types that you want drawn by Odin Inspector can be a smart idea.

If you do this, you can enable Odin Inspector for all the types in that namespace with a single click.

Here is an example:

using UnityEngine;

namespace MyCompany.OdinEnhanced
{
	public class ExampleComponent : MonoBehaviour
	{
		[Sirenix.OdinInspector.Attributes.AssetList]
		public GameObject Prefab;
	}
}