{"id":836,"date":"2019-09-04T18:00:53","date_gmt":"2019-09-04T18:00:53","guid":{"rendered":"https:\/\/docs.sisus.co\/power-inspector\/?p=836"},"modified":"2021-03-24T18:09:28","modified_gmt":"2021-03-24T18:09:28","slug":"compatibility-with-odin-inspector","status":"publish","type":"post","link":"https:\/\/docs.sisus.co\/power-inspector\/compatibility\/compatibility-with-odin-inspector\/","title":{"rendered":"Compatibility with Odin Inspector"},"content":{"rendered":"<p><a href=\"https:\/\/assetstore.unity.com\/packages\/tools\/utilities\/odin-inspector-and-serializer-89041?aid=1100l7SbZ\"><img loading=\"lazy\" src=\"https:\/\/api.assetstore.unity3d.com\/affiliate\/embed\/package\/89041\/icon\" alt=\"Odin - Inspector and Serializer\" width=\"128\" height=\"128\" \/><\/a><\/p>\n<p>If you are an Odin Inspector user, you will be able to hold on to the <strong>Odin experience<\/strong> you have gotten used to <strong>inside Power Inspector<\/strong>. You can <strong>combine<\/strong> the best of both words; Odin&#8217;s comprehensive <strong>attribute drawer collection<\/strong> being drawn <strong>inside Power Inspector<\/strong>, where you have your <strong><a href=\"https:\/\/docs.sisus.co\/power-inspector\/features\/back-and-forward-buttons\/\">back and forward buttons<\/a><\/strong>, a <strong><a href=\"https:\/\/docs.sisus.co\/power-inspector\/features\/search-box\/\">search box<\/a><\/strong>, <strong><a href=\"https:\/\/docs.sisus.co\/power-inspector\/features\/split-view\/\">split view<\/a><\/strong>, <strong><a href=\"https:\/\/docs.sisus.co\/power-inspector\/features\/debug-mode\/\">Debug Mode+<\/a><\/strong> and <strong><a href=\"https:\/\/docs.sisus.co\/power-inspector\/category\/features\/\">more<\/a><\/strong> to boost your workflow.<\/p>\n<p>To use the two of them together you must make a decision about <strong>which one<\/strong> of them will handle <strong>drawing<\/strong> the <strong><a href=\"https:\/\/docs.sisus.co\/power-inspector\/terminology\/members\/\">class members<\/a><\/strong> of <strong><a href=\"https:\/\/docs.sisus.co\/power-inspector\/terminology\/target-object\/\">targets<\/a><\/strong> within the <a href=\"https:\/\/docs.sisus.co\/power-inspector\/terminology\/inspector-view\/\"><strong>inspector<\/strong><\/a>.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-838\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/09\/InspectorUnityObjectDrawer.png\" alt=\"\" width=\"322\" height=\"228\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/09\/InspectorUnityObjectDrawer.png 322w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/09\/InspectorUnityObjectDrawer-300x212.png 300w\" sizes=\"(max-width: 322px) 100vw, 322px\" \/><\/p>\n<p>For classes where you <strong>are using<\/strong> Odin&#8217;s inspector-related attributes, you will likely want to let <strong>Odin<\/strong> handle the drawing. This ensures that <strong>all<\/strong> attribute enhancements are in full effect inside Power Inspector.<\/p>\n<p>For classes where you are <strong>not using<\/strong> Odin&#8217;s inspector-related attributes, you can let <strong>Power Inspector<\/strong> handle the drawing. However if you would like to let Odin handle drawing of <strong>all<\/strong> class members across the board, that is also totally possible.<\/p>\n<p>If you only want to use <strong>Odin&#8217;s serializer<\/strong>, but don&#8217;t plan on using any of the attributes that it offers, then you can let <strong>Power Inspector<\/strong> handle the drawing of all classes without any issues.<\/p>\n<h1>Odin Attribute Conversion Support<\/h1>\n<p>Odin doesn&#8217;t use <strong><a href=\"https:\/\/docs.sisus.co\/power-inspector\/compatibility\/compatibility-with-property-drawers\/\">PropertyDrawers<\/a><\/strong> for drawing attribute-decorated fields, but has a totally custom drawer system which only functions inside Odin&#8217;s own custom Editor. This makes it difficult to slip in Odin&#8217;s attribute-based enhancements into Power Inspector <strong>at the field-level,<\/strong> pretty much necessitating the use of Odin&#8217;s custom Editor inside Power Inspector.<\/p>\n<p>Despite this difficulty as of Power Inspector 1.3.1 some of Odin&#8217;s attributes are now in fact supported <strong>even inside Power Inspector&#8217;s own drawers<\/strong>. This is made possible by a new system called <strong>PluginAttributeConverterProvider<\/strong> which can convert a subset of Odin&#8217;s attributes into corresponding Power Inspector attributes.<\/p>\n<p>The <strong>Odin attributes<\/strong> currently supported when using <strong>Power Inspector&#8217;s drawers<\/strong> are as follows:<\/p>\n<ul>\n<li>ShowInInspectorAttribute<\/li>\n<li>ButtonAttribute<\/li>\n<li>ReadOnlyAttribute<\/li>\n<li>RequiredAttribute<\/li>\n<li>TitleAttribute<\/li>\n<li>InfoBoxAttribute<\/li>\n<li>DetailedInfoBoxAttribute<\/li>\n<li>ShowIfAttribute<\/li>\n<li>DisableIfAttribute<\/li>\n<li>DisplayAsStringAttribute<\/li>\n<li>MultiLinePropertyAttribute<\/li>\n<li>PropertySpaceAttribute<\/li>\n<li>InlinePropertyAttribute<\/li>\n<\/ul>\n<blockquote><p>Note that the equivalent Power Inspector attribute drawers won&#8217;t necessarily be completely identical to the ones used by Odin Inspector &#8211; just close enough in terms of functionality.<\/p><\/blockquote>\n<h1>Which Drawer Should I Use By Default?<\/h1>\n<p>The best way to figure this out is to <strong>try them both out<\/strong> for yourself and see which one <strong>you<\/strong> like better!<\/p>\n<p>When using <strong>Power Inspector<\/strong> you get things like <strong><a href=\"https:\/\/docs.sisus.co\/power-inspector\/features\/keyboard-navigation\/\">enhanced keyboard support<\/a><\/strong> and an <a href=\"https:\/\/docs.sisus.co\/power-inspector\/enhanced-gui-instructions\/object-reference-gui-instructions\/\"><strong>enhanced Object reference field<\/strong><\/a>, but Odin Inspector has its own set of enhancements it offers as well.<\/p>\n<h1>Having Power Inspector Draw All Class Members<\/h1>\n<p>To make Power Inspector draw all class members set the preference item <a href=\"https:\/\/docs.sisus.co\/power-inspector\/preferences\/use-editors-over-drawers\/\"><strong>Use Editors Over Drawers<\/strong><\/a>\u00a0to <strong>Only If Has Custom Editor<\/strong>.<\/p>\n<h1>Having Odin Inspector Draw All Class Members<\/h1>\n<p>To make Odin draw all class members set the preference item <strong>Use Editors Over Drawers<\/strong> to <strong>Based On Plug-ins<\/strong> or <b>Always.<\/b><\/p>\n<h1>Selecting Drawer For Each Type<\/h1>\n<p>If you set the preference item <strong>Use Editors Over Drawers<\/strong> set to <strong>Based On Plug-in Preferences <\/strong>(the default setting), then you will be able to control exactly which types are drawn by which plug-in.<\/p>\n<p>You can configure the drawer for each type using the <strong>Preferences<\/strong> window in <strong>Odin Inspector<\/strong>.<\/p>\n<ol>\n<li>Select <strong>Edit &gt; Preferences<\/strong>.<\/li>\n<li>Select the <strong>Odin Inspector<\/strong> view and click the <strong>Show Odin Preferences<\/strong>\u00a0button.<\/li>\n<li>Select the <strong>Editor Types<\/strong> view.<\/li>\n<li>Make sure that <strong>Enable Odin In Inspector<\/strong> is <strong>enabled.<\/strong><\/li>\n<li>In the <strong>Draw Odin for<\/strong> 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.<\/li>\n<\/ol>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-847\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/09\/OdinInspectorEditorTypes.png\" alt=\"\" width=\"624\" height=\"276\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/09\/OdinInspectorEditorTypes.png 624w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/09\/OdinInspectorEditorTypes-300x133.png 300w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/p>\n<h1>On Script Organization<\/h1>\n<p>Since the types listed in the Editor Types view are <strong>organized by namespace<\/strong>, using your namespaces to <strong>separate types<\/strong> that you want <strong>drawn by Odin Inspector<\/strong> can be a smart idea.<\/p>\n<p>If you do this, you can enable Odin Inspector for all the types in that namespace with a <strong>single click<\/strong>.<\/p>\n<p>Here is an <strong>example<\/strong>:<\/p>\n<pre>using UnityEngine;\r\n\r\nnamespace MyCompany.OdinEnhanced\r\n{\r\n\tpublic class ExampleComponent : MonoBehaviour\r\n\t{\r\n\t\t[Sirenix.OdinInspector.Attributes.AssetList]\r\n\t\tpublic GameObject Prefab;\r\n\t}\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s comprehensive attribute drawer collection being drawn inside Power Inspector, where you have your back and forward buttons, a search box, ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/docs.sisus.co\/power-inspector\/compatibility\/compatibility-with-odin-inspector\/\" title=\"read more\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[],"_links":{"self":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/836"}],"collection":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/comments?post=836"}],"version-history":[{"count":30,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/836\/revisions"}],"predecessor-version":[{"id":1851,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/836\/revisions\/1851"}],"wp:attachment":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/media?parent=836"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/categories?post=836"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/tags?post=836"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}