{"id":426,"date":"2019-05-06T16:19:29","date_gmt":"2019-05-06T16:19:29","guid":{"rendered":"https:\/\/docs.sisus.co\/power-inspector\/?p=426"},"modified":"2021-03-24T17:45:17","modified_gmt":"2021-03-24T17:45:17","slug":"object-reference-drawer","status":"publish","type":"post","link":"https:\/\/docs.sisus.co\/power-inspector\/enhanced-drawers\/object-reference-drawer\/","title":{"rendered":"Object Reference Drawer"},"content":{"rendered":"<p>The drawer for\u00a0<a href=\"https:\/\/docs.sisus.co\/power-inspector\/terminology\/unity-object\/\">Unity Object<\/a> reference fields in Power Inspector has been enhanced with addition features.<\/p>\n<h1>The Drag N Drop Conundrum<\/h1>\n<p>A common problem in the <a href=\"https:\/\/docs.sisus.co\/power-inspector\/terminology\/default-inspector\/\">default inspector<\/a> occurs, when you want to assign a reference to a <a href=\"https:\/\/docs.unity3d.com\/Manual\/Components.html\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Component<\/strong><\/a> field, but the Component resides on a <strong>different <a href=\"https:\/\/docs.unity3d.com\/Manual\/class-GameObject.html\" target=\"_blank\" rel=\"noopener noreferrer\">GameObject<\/a><\/strong>.<\/p>\n<p>How do you do that exactly?<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-431\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/05\/DragNDropConundrum.png\" alt=\"\" width=\"573\" height=\"212\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/DragNDropConundrum.png 573w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/DragNDropConundrum-300x111.png 300w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/DragNDropConundrum-150x55.png 150w\" sizes=\"(max-width: 573px) 100vw, 573px\" \/><\/p>\n<p>If you try to <strong>drag-n-drop<\/strong> the target GameObject from the hierarchy view, it always just assigns its Transform Component.<\/p>\n<p>The <strong>Object Picker<\/strong> is no help here either, as it can&#8217;t be used to select a specific Component inside a GameObject.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-433\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/05\/ObjectPicker.png\" alt=\"\" width=\"200\" height=\"366\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectPicker.png 200w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectPicker-164x300.png 164w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectPicker-82x150.png 82w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/><\/p>\n<p>The only way to get around this problem in the default inspector is through an <strong>obscure<\/strong> and <strong>lengthy<\/strong> process involving the opening of multiple inspector windows and the locking of views. I suspect it&#8217;s something that many users don&#8217;t even know how to do.<\/p>\n<h1>Cross-GameObject Drag-N-Drop<\/h1>\n<p>In <strong>Power Inspector<\/strong>, if you drag a GameObject reference from the hierarchy view to a Component field, the quick select <strong>context menu<\/strong> pops open, letting you <strong>specify<\/strong> exactly which Component you wish to assign.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-675\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/05\/DragNDropQuickSelectMenu.png\" alt=\"\" width=\"842\" height=\"292\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/DragNDropQuickSelectMenu.png 842w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/DragNDropQuickSelectMenu-300x104.png 300w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/DragNDropQuickSelectMenu-768x266.png 768w\" sizes=\"(max-width: 842px) 100vw, 842px\" \/><\/p>\n<p>(If you do the same with an Unity Object field, the same thing happens, except this time the dragged GameObject is also listed as an additional option.)<\/p>\n<h1>Quick Select Context Menu<\/h1>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-429\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/05\/ObjectFieldQuickSelectMenu.png\" alt=\"\" width=\"322\" height=\"166\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectFieldQuickSelectMenu.png 322w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectFieldQuickSelectMenu-300x155.png 300w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectFieldQuickSelectMenu-150x77.png 150w\" sizes=\"(max-width: 322px) 100vw, 322px\" \/><br \/>\nYou can also <strong>manually<\/strong> open the quick select context menu by <strong>right-clicking<\/strong> the object reference control.<br \/>\nWhen opened in this manner, the menu will list <strong>all<\/strong> valid targets within the open Scenes.<\/p>\n<p>All options will be <strong>hierarchically<\/strong> <strong>organized<\/strong> in the same order as they appear in the Hierarchy view, providing a fast and intuitive method for locating your target.<\/p>\n<h1>The Eyedropper Tool<\/h1>\n<p>You can use the new eyedropper tool functionality to easily <strong>pick targets<\/strong> from the <strong>scene view<\/strong> simply <strong>by clicking them<\/strong>.<\/p>\n<p><iframe loading=\"lazy\" title=\"Eyedropper for Object Fields in Unity | Power Inspector\" width=\"730\" height=\"411\" src=\"https:\/\/www.youtube.com\/embed\/VQsBgdlNnLA?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>To start using the eyedropper tool <b>click <\/b>the circular <strong>eyedropper icon<\/strong> found at the right edge of the object drawer.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-1619\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/10\/unity-object-field-eyedropper.png\" alt=\"\" width=\"350\" height=\"20\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/10\/unity-object-field-eyedropper.png 350w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/10\/unity-object-field-eyedropper-300x17.png 300w\" sizes=\"(max-width: 350px) 100vw, 350px\" \/><\/p>\n<p>If you have chosen to <a href=\"https:\/\/docs.sisus.co\/power-inspector\/preferences\/draw-object-field-eyedropper\/\"><strong>disable the eyedropper icon in preferences<\/strong><\/a>, you can start using the eyedropper tool by <strong>right-clicking<\/strong> the circular <strong>object picker icon <\/strong>instead.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-1462\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/05\/Unity-Object-Field-Eyedropper-Tool-right-click.png\" alt=\"\" width=\"282\" height=\"33\" \/><\/p>\n<p>You can also active the eyedropper tool from the the context menu of the object reference drawer, by <strong>right-clicking<\/strong> the <strong>prefix label<\/strong> and selecting the <strong>Eyedropper Tool<\/strong> item.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-1461\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/05\/Unity-Object-Field-Eyedropper-Tool.png\" alt=\"\" width=\"281\" height=\"110\" \/><\/p>\n<p>Once the eyedropper tool is active you just need to <strong>click something<\/strong> in the <strong>scene view<\/strong> to assign it to the object field.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-1463\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/05\/eyedropper-scene-view.png\" alt=\"\" width=\"872\" height=\"384\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/eyedropper-scene-view.png 872w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/eyedropper-scene-view-300x132.png 300w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/eyedropper-scene-view-768x338.png 768w\" sizes=\"(max-width: 872px) 100vw, 872px\" \/><\/p>\n<p>If the type of the object field is GameObject or Transform, then its value will immediately get assigned to match the clicked target.<br \/>\nIf the type of the object field is something Object or component, then a <strong>popup menu might appear<\/strong> asking you to <strong>specify which<\/strong> <strong>Object<\/strong> to assign from the target you picked.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-1464\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/05\/eyedropper-pick-component.png\" alt=\"\" width=\"872\" height=\"384\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/eyedropper-pick-component.png 872w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/eyedropper-pick-component-300x132.png 300w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/eyedropper-pick-component-768x338.png 768w\" sizes=\"(max-width: 872px) 100vw, 872px\" \/><\/p>\n<h1>Flexible Copy-Paste<\/h1>\n<p>You can <a href=\"https:\/\/docs.sisus.co\/power-inspector\/features\/copy-paste\/\">copy-paste values<\/a> between Object reference class members in Power Inspector, just like you would with other fields.<\/p>\n<p>In addition to this, you can paste references to the Object reference drawer from the following sources:<\/p>\n<ol>\n<li>References copied from GameObject, Component and asset <strong>headers<\/strong> in Power Inspector.<\/li>\n<li>References copied from the <strong>Hierarchy<\/strong> view.<\/li>\n<li>References copied from the <strong>Project<\/strong> view.<\/li>\n<li><strong>Asset paths<\/strong> in the clipboard (for example via the &#8220;<strong>Copy Path<\/strong>&#8221; context menu item)<\/li>\n<\/ol>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-436\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/05\/ObjectFieldCopySources.png\" alt=\"\" width=\"925\" height=\"280\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectFieldCopySources.png 925w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectFieldCopySources-300x91.png 300w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectFieldCopySources-768x232.png 768w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/05\/ObjectFieldCopySources-150x45.png 150w\" sizes=\"(max-width: 925px) 100vw, 925px\" \/><\/p>\n<blockquote><p><strong>Note<\/strong>: Pasting reference from the Hierarchy and Project views works only when copied using the &#8220;<strong>Edit\/Copy&#8221;<\/strong> menu item or with the keyboard shortcut <strong>Ctrl+C<\/strong> (<strong>Cmd+C<\/strong> on macOS). References copied using the context menu won&#8217;t work.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>The drawer for\u00a0Unity Object reference fields in Power Inspector has been enhanced with addition features. The Drag N Drop Conundrum A common problem in the default inspector occurs, when you want to assign a reference to a Component field, but the Component resides on a different GameObject. How do you do that exactly? If you ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/docs.sisus.co\/power-inspector\/enhanced-drawers\/object-reference-drawer\/\" 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":[13],"tags":[],"_links":{"self":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/426"}],"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=426"}],"version-history":[{"count":25,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/426\/revisions"}],"predecessor-version":[{"id":1822,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/426\/revisions\/1822"}],"wp:attachment":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/media?parent=426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/categories?post=426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/tags?post=426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}