Advanced Inspector - Manual
Advanced Inspector - Tutorials
FOR DIRECT SUPPORT, JOIN OUR DISCORD CHANNEL
The Inspector, or in other engine the “property grid”, is one of the most important tool we have to use. It’s the window to all our data, and if this tool is lacking, everything we do and how fast we do it, will also suffer from it.
There’s lot of Inspector package in the Asset Store, but none that we feel give us the “full package”. To solve this issue, we’ve been working on this package for over seven months. One of the first thing we found out is, the classes behind the Inspector - SerializedProperty, SerializedObject - were also too limited for our needs, surprisingly restrained to a single serialization context. We rewrote them from scratch.
In this package, everything how the Inspector draw and handle data have been reworked from the ground up. “Advanced Inspector” is what we believe Unity’s Inspector should have been from the start. Please consult the manual for an up-to-date list of the features.
https://www.youtube.com/watch?v=OUFMgCBoCao
Basic Features
That being said, we had to support at least as much as what Unity does;
- Undo
- Prefab handling
- Multi-object editing
- “Script” field
Here’s a list of the basic features that Unity’s Inspector does not support and we added;
-
Every non-static fields, properties or parameter-less method can be exposed.
-
Every list and array now have +/- button to add and remove index.
-
Every list and array’s nodes can be dragged around to reorder them.
-
Every field can be expanded to display the inner fields, being in a list or not.
-
Every type’s editing field is now handled by a “field editor”.
-
Every label can be right-clicked for a contextual menu. Extra “type-dependent” menu can be added from its field editor.
-
Every fields can be copy/pasted, even complex type, such as struct, or ComponentMonoBehaviour hierarchy.
-
Every fields can be apply or reverted independently. No need to apply/revert the whole prefab.
-
Every fields can have a URL to an help page.
-
Every fields is fully dynamic; can be hidden, renamed, change color, display help box or change how the data is exposed at runtime.
-
Unlimited number of depth, not limited to a single serialization context.
-
The inspector is now separated into two columns, one for the labels, one for the editing field. The separator can be moved around, no space wasted.
-
Support for Unity’s “exotic” type, such as LayerMask, Color32 or Bounds.
-
Add new data type, like Unity-friendly Dictionary, Ranges or Action Bindings
-
Control the Preview section of the Inspector without a custom editor.
-
and much more.
Sub Components
Another important feature that we used to have in other engines was the ability to create polymorphic sub-component directly from the property grid. The same way components in a GameObject are useful, breaking down a complex behaviour into smaller parts is also incredibly important. This design is usually named “Composition”. However, Unity doesn’t support serialization of polymorphic object deriving from System.Object.
To solve this issue, the new Inspector handles a new base class - ComponentMonoBehaviour - differently.
When a field is flagged with “CreateDerived” attribute, the normal object field is turned into the above. The “+” sign, when clicked on, display the list of class that derive from this base type. Selecting one create an instance of that type. When a field is filled, the “+” sign turns into a “-” sign to destroy that instance.
There’s an unlimited number of depth in “sub-components” references. It is, we believe, one of the most powerful feature of this package, as we use it on a daily basis.
Attributes
To handle how all the data is handled and drawn, there’s now a huge list of attributes that can be placed on classes, fields, properties or even methods. Each modify the final result, and in most case, that can be combined with each other for very specific behaviour.
-
AdvancedInspector: Allow to hide the script or prevent the default Unity’s behaviour of inspecting serialized item.
-
Angle: Turn a int or float field into a spinning angle wheel that can be set to increment over specific values.
-
Bypass: When a Field/Property of a Unity type is flag with it, its internal values are displayed using the Advanced Inspector.
-
CollectionConstructor: Allows item created in a list/arrow to be created from a method of your choice. It is now possible to populate a list from object with a specific constructor!
-
CreateDerived: Allow the user to create an instance deriving from this field/property base type.
-
Descriptor: Change the Field/Property name, tooltip, or even color. This is a runtime attribute.
-
DisplayAsParent: A nested object is displayed as being part of the parent.
-
DontAllowSceneObject: Object picker ignores the current scene and only list the project’s objects.
-
Expandable: Override the expandability of an item.
-
FieldAttribute: Similar to Unity’s property drawers, but can be applied to non-serialized fields, properties and method. Also support Layouting.
-
FieldEditor: Override a specific field/property to use an alternative field editor.
-
Group: Group a collection of field under the same drop down.
-
Help: Display a help box under this field. This is a runtime attribute.
-
Inspect: Flag the member you wish to display on the inspector. It is not related if this value is serialized of not. This is a runtime attribute.
-
MaskedEnum: Turn an enum into a masked enum. (bitfield)
-
RangeValue: Same as Unity’s Range attribute, but not restricted to Field placement.
-
ReadOnly: Prevent this field from being edited, but is still displayed. This is a runtime attribute.
-
Restrict: Turns any field into a drop down list of specific choices. This is a runtime attribute.
-
RuntimeResolve: The FieldEditor is fetch using the runtime type instead of the field type, or you can force a specific type to be used - useful when the value is null.
-
Size: Force a list or array to be of a fixed size.
-
Space: Add space after this field.
-
Style: Force a field to be drawn using an alternative GUIStyle.
-
Tab; Classify your fields under tabs.
-
TextField: Change a string field into; Text Field, Text Area, Password, Tag, File Picker, Folder Picker
-
Toolbar: Group item horizontally in a toolbar.
Most attributes have plenty of parameters to make them as flexible as possible. Listing every possibility would be far too long.
Runtime attribute are able to take a method’s name or a delegate to retrieve their current settings at runtime. Which mean, you can bind a field to another, change a help box message, or even change the name and color of a field based on whatever condition you want. The system also pass down any attribute sporting IListAttribute interface to the children field of a list or array.
The system is also fully extensible to support your own type or your own attributes. There is no limit to the number of attribute a member can sport. You can still write your own Editor while using the feature of the Advanced Inspector. We rewrote Unity’s type editor this way. You can also write your own FieldEditor if you want to display a specific type in a specific way.
Type-bound PropertyDrawer are supported since version 1.52.
Attribute-bound PropertyDrawer are supported since version 1.67.
FieldAttribute and FieldEditor replaces PropertyDrawers, without the limitation!
Current version on the Asset Store; 1.72a (Supports Unity 5.2, 5.3, 5.4, 5.5, 5.6 and 2017.1)
Current issue exists on .NET 4.6.
See the manual for the latest changelist.
Note that version 1.60+ is only supported on Unity 5.2 and above.
Version under 1.60 is supported on 4.3, 4.6, 4.7 and 5.0.