The drawer for Unity Object reference fields in Power Inspector has been enhanced with addition features.
The Drag N Drop Conundrum
How do you do that exactly?
If you try to drag-n-drop the target GameObject from the hierarchy view, it always just assigns its Transform Component.
The Object Picker is no help here either, as it can’t be used to select a specific Component inside a GameObject.
The only way to get around this problem in the default inspector is through an obscure and lengthy process involving the opening of multiple inspector windows and the locking of views. I suspect it’s something that many users don’t even know how to do.
In Power Inspector, if you drag a GameObject reference from the hierarchy view to a Component field, the quick select context menu pops open, letting you specify exactly which Component you wish to assign.
(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.)
Quick Select Context Menu
You can also manually open the quick select context menu by right-clicking the object reference control.
When opened in this manner, the menu will list all valid targets within the open Scenes.
All options will be hierarchically organized in the same order as they appear in the Hierarchy view, providing a fast and intuitive method for locating your target.
The Eyedropper Tool
You can use the new eyedropper tool functionality to easily pick targets from the scene view simply by clicking them.
To start using the eyedropper tool click the circular eyedropper icon found at the right edge of the object drawer.
If you have chosen to disable the eyedropper icon in preferences, you can start using the eyedropper tool by right-clicking the circular object picker icon instead.
You can also active the eyedropper tool from the the context menu of the object reference drawer, by right-clicking the prefix label and selecting the Eyedropper Tool item.
Once the eyedropper tool is active you just need to click something in the scene view to assign it to the object field.
If the type of the object field is GameObject or Transform, then its value will immediately get assigned to match the clicked target.
If the type of the object field is something Object or component, then a popup menu might appear asking you to specify which Object to assign from the target you picked.
You can copy-paste values between Object reference class members in Power Inspector, just like you would with other fields.
In addition to this, you can paste references to the Object reference drawer from the following sources:
- References copied from GameObject, Component and asset headers in Power Inspector.
- References copied from the Hierarchy view.
- References copied from the Project view.
- Asset paths in the clipboard (for example via the “Copy Path” context menu item)
Note: Pasting reference from the Hierarchy and Project views works only when copied using the “Edit/Copy” menu item or with the keyboard shortcut Ctrl+C (Cmd+C on macOS). References copied using the context menu won’t work.