Skip to content

A simple editor inspector enhancement for Unity3D. Support public and non-public properties, fields, methods and also static members.

License

Notifications You must be signed in to change notification settings

darkfall/ShowInEditor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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";
    }

About

A simple editor inspector enhancement for Unity3D. Support public and non-public properties, fields, methods and also static members.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages