Brief
A simple editor inspector enhancement for Unity3D.
Adding support for showing public & non-public properties, fields, methods and static members in the editor inspector.
Support nested objects.
License: MIT
How to
Add [ShowInEditor] attribute to the members you want to show in the inspector. For example:
[ShowInEditor(Comment = "This is a private field")] int privateField = 42;Create a custom editor for the type and inherit from AU.AUEditor
[CustomEditor(typeof(AType))] class AEditor : AU.AUEditor<AType> { }Done!
Attribute Options
Comment (string)
Comment will be shown above the field
CommentType (ShowInEditorMessagetype)
Message type of the comment helpbox
Name (string)
Override the name of the field
CommentColor (ShowInEditorColor)
Color of the comment file
FieldColor (ShowInEditorColor)
Color of the field
CanModifyArrayLength (bool)
When the member is an array, can the user modify the length of the array in the inspector or not. Default is false
CompressArrayLayout (bool)
When the member is an array, compress the array layout into a horizontal group to save space. Only supports primitive types.
Style (ShowInEditorStyle)
Default, Button, Slider
Group
When the member is a method and its a button, group the button horizontally by the group index. Default is -1 means no group at all.
RangeMin/RangeMax
Range of int / float values, also serves as range min / max when the style is slider
Nested Object
If you want custom structs/classes/components also showing in the inspector, the type of the object must also be decorated by the [ShowInEditor] attribute. For example:
[ShowInEditor]
class SimpleClass
{
[ShowInEditor(Comment = "By default, only public members are modifiable")]
public int i = 42;
[ShowInEditor(Comment = "But you can modify it with flags = ShowInEditorFlags.ReadWrite", Flags = ShowInEditorFlags.ReadWrite)]
string xixi = "XD";
}
