16. Improved Tooltips

  04. Features No Comments

Tooltip Icon

The way that tooltips are handled in the default inspector has a couple of issues:

  1. There’s no indicator to let you know whether a class member has a tooltip or not. Many have them, and many don’t, and the only way to figure out which ones do, is by hovering your cursor over each one long enough to test if anything pops up or not. Worse still, tooltips don’t seem to pop open reliably, which means that even if you try to mouseover a prefix label and nothing happens, you still can’t be certain that the field doesn’t have a tooltip.
  2. Tooltips always pop open when your cursor hovers over a prefix label. Since prefix labels serve other purposes besides dispensing tooltips, such as allowing the adjustment of numeric class member values when dragged, and opening the context menu when right-clicked, this can sometimes be quite obtrusive. With Power Inspector adding a lot more useful context menu items, the problem only exacerbates.

To solve both of these issues, Power Inspector introduces the tooltip icon.
Whenever a class member contains a tooltip, a dedicated tooltip icon will be shown next to the field prefix, and tooltips will only be shown when this icon is mouseovered.

This both communicates to users in a clear fashion when tooltip information is available, as well as gets rid of the issue of tooltips popping open when the intention is to drag or right-click prefix labels.

Tip: If you don’t want to use tooltip icons for tooltips, you can disable the feature in the Preferences view.

TooltipAttribute Support

Power Inspector supports the Tooltip attribute just like the default inspector does. However, as mentioned before, all tooltips are now shown through a dedicated tooltip icon by default.

XML Documentation Comment Support

Using the Tooltip attribute to generate tooltips has a couple of shortcomings:

  1. Only serialized fields are supported. With Power Inspector supporting the displaying members of all kinds, this can start feeling restrictive at some point.
  2. If you also use XML documentation comments to provide tooltips to coders, it can lead to you having to write the same information twice: once for the tooltip attribute, and a second time for the documentation comment.

To solve these issues, Power Inspector can automatically generate tooltips from the XML documentation comments in your code.
This feature works with fields, properties, methods, parameters and indexers. It supports instance members as well as static members.
XML comments can be read from the XML Documentation of compiled DLL files (when available), or parsed from the MonoScript assets in your Project.