It is possible to add your own toolbar items to the Power Inspector toolbar. To do this create a new class that derives from ToolbarItem and has the ToolbarItemFor attribute with PowerInspectorToolbar as its target. Then at the minimum you need to implement the OnRepaint method for drawing your item, and OnActivated method for reacting ..
Assembly Definition Files Power Inspector makes use of assembly definition files to separate its scripts into assemblies that are kept separate from the other scripts in your project. This reduces the compilation times in your project, because Unity does not need to rebuild the Power Inspector assemblies every time you make changes to your own ..
If you want to modify an existing drawer that ships with Power Inspector, it is not recommended to do this by directly editing the class file. This could result in conflicts if future updates to Power Inspector should change the same file. Instead you should create your own class that extends the drawer you want ..
Extending A Base Class If you want to create a new drawer for an asset type Unity Object, you can derive from one of two base classes that implements the IAssetDrawer interface. Asset type Unity Objects refer to Unity Objects that cannot exist in the scene, that is all Unity Objects except Components and GameObjects. ..
Extending A Base Class If you want to create a new drawer for a component, you can derive from one of two base classes that implements the IComponentDrawer interface. 1. ComponentDrawer Extend ComponentDrawer if an Editor is not used for drawing the class members of the Component. This gives you the most power to customize ..
Power Inspector uses the object pool pattern, reusing existing instances of drawers to reduce the amount of garbage generated. For this reason, when creating your own drawers, you’ll need to be careful that they are reverted back to their default states when they are disposed in the pool. Dispose method When drawers instances are placed ..
Extending A Base Class For most drawer that represent class members, you have to base classes you can inherit from that implement the IFieldDrawer interface. 1. PrefixControlComboDrawer For simple class members that don’t have any member drawers and consist only of a prefix label and a single control, you can derive from PrefixControlComboDrawer. Example: ToggleDrawer ..
You can add new context menu items to Unity Object targets just like you always have using the MenuItemAttribute. If you would like to add new items to the context menus of other drawers, you can do so by subscribing to the OnMenuOpening callback in the ContextMenuUtility class. This gets called after the context menu ..
Basic Requirements of a Drawer When creating your own drawer for use in Power Inspector, your class needs to fulfill the following requirements: The class should be decorated with an attribute that derives from DrawerForBase attribute. This lets Power Inspector know what elements inside the inspector should be handled by the drawer. The class should ..
With development mode enabled, if you right-click a drawer while holding down the ctrl key (cmd key on macOS), a new group called “Debugging” will appear in the context menu. This menu will contain a number of additional menu items that can be useful when you’re creating new drawers. The first item, “Debugging/Edit [NameOfDrawer].cs”, can ..