Advanced Inspector - Never Write An Editor Again

The version 1.4 changelist looks like this so far;

  • Added a new attribute; Background, which color the box of expandable item.
  • MaskedEnum attribute is replaced by the Enum attribute, which also controls how an enum is displayed.
  • Merge the Size attribute with the CollectionConstructor attribute into the new Collection attribute.
  • Toolbars are no longer using the toolbar style by default. You can do row of buttons this way.
  • Toolbars are now drawn on the header, because they collided with the separator.
  • Descriptor color now colors field instead of label. It made no sense to color the label, and was often hard to read.
  • Descriptor with only a color no longer pass on an empty name to the label.
  • Added a missing constructor in AdvancedInspector attribute.
  • Expandable attribute now has the InspectDefaultItems similar to the AdvancedInspector attribute.
  • Fixed an error raised when encountering a type with multiple overload of ToString.
  • Fixed an issue when undoing creation or deletion of an item in a collection was not properly refreshing it.
  • Fixed an issue that prevented proper undoing of collection reordering.
  • Added multiple display option to the Enum attribute, see the EnumDisplay enum.
  • Added multiple display option to the Collection attribute, see the CollectionDisplay enum.
  • Added multiple display option to the Restrict attribute, see the RestrictDisplay enum.
  • Added a “Collection Locked” option to the contextual menu, it locks every collection from adding/removing/sorting items.
  • Added a Tutorial documentation, which gives steps by steps examples of implementation.
  • Fixed an issue that prevented copy pasting AnimationCurve.
  • Fixed an issue that custom-made Editor that were not overloading RefreshFields would fail.
  • Removed the “EditedTypes” and “EditDerived” from the InspectorEditor, as the CustomEditor attribute values are now used.

I skipped 1.33 because of some major changes in attributes definition. All enum control are now in the EnumAttribute and all collection control are in CollectionAttribute.

Restricted field, Collection and Enum now have display options;

The online documentation have been updated and a first series of basic tutorial have been added; http://lightstrikersoftware.com/docs/AdvancedInspector_Tutorials.pdf

The tutorial are only in their first iterations, and more will be added. Also, if you have issues with some features, I’ll gladly write tutorial specific to your problems.

1.4 should be submitted to the asset store this week.

sounds great, can’t wait!

1.4 have been submitted to the Asset Store.

Note that lot of stuff changed, and when this occurs, it’s not unusual to find bugs. We tried to test everything, but it’s not always possible. Contact us if you find any, we will fix them ASAP.

any way to control indentation like for arrays etc?

What do you mean?

I have an array of serialised custom classes and I would like the children of said array to all be indented more to the right. The indentation that AI makes is very slight and I would like to be able to increase it.

For example, I can control vertical-spacing by adding [AdvancedInspector.Space (20)]. I’ve looked thru the pdf but I couldn’t see anything to increase indentation. Something like an attribute I could put above an array that would increase the indentation of it’s children. EG: [AdvancedInspector.Indentation (5)]. Maybe its there and I just missed it or something.

Ah! I understand. No, right now there is no such thing. I’ll look into it.

great, thanks!

Version 1.4 is now available.

great. thanks for the update!

Hi LightStriker

I downloaded 1.4 and was playing around with it in Unity 4.5.3, but I’m running into some issues that I wonder if you could help me with.

I’m getting this exception while using the AIExample_IList Attribute script, specifically if I add it to an empty game object and try to add a new entry in the (currently empty) base list, I get this:

NullReferenceException: Object reference not set to an instance of an object
AdvancedInspector.AdvancedInspectorControl.AddItem (AdvancedInspector.InspectorField field, System.Type type)
AdvancedInspector.AdvancedInspectorControl.CreateDerived (AdvancedInspector.InspectorField field, System.Type type)
AdvancedInspector.AdvancedInspectorControl.ModalClosed (.ModalWindow window)
ModalWindow.Ok ()
Toolbox.OnDoubleClick ()

It seems to go away if I change the array into a list and new the list, Unity inspector works just fine without doing that though.

I also found that if I remove entries from the baselist via the first minus sign without zeroing out the entry first, that entry and its children are leaked and stays in the saved scene file even though it’s no longer in the list.

Finally I can’t seem to edit any instances of ComponentC, even though ComponentB and componentA work just fine.

Thanks

I’m trying to use the Advanced Inspector for the first time and I’m getting a bunch of NullReferenceException type errors. Specifically when I’m working with the Camera.

I’m using Unity 4.6.0b18.

Are these known issues you are working on or should I get a little more info together for you to investigate?

Hey,

Sorry for the late answer, looks like the forum somehow decided I wasn’t subscribed to this thread anymore.

I’ve noted the same lately. Looks like I broke the automatic array initialization when I change the Collection attribute behaviour. One of the thing I had to do - that most people are unaware of - is that the standard Inspector initialize array and list when you create an object.

The error goes away if you save your scene and reload it, because the array will now be loaded from the serialization.

Another workaround is to initialize your array as such;

public Sprite[] sprites = new Sprite[0];

Just to be clear, it’s a bug, and I’ll soon release a new version to fix it.

Now that is odd. Those behaviour shouldn’t have changed, and I wasn’t expecting any change in 4.5.3. I’ve tested on 4.5.1. I’ll look into it.

Unity 4.6 is still in beta, so I can’t really release anything for it yet, since it could still change. I’ve noted the same null in the camera and a patch will be release soon after 4.6 is live.

Thanks a lot for the feedbacks.

The version 1.41 have been submitted to the Asset Store with the following changelist;

  • Fixed a Null Exception on the CameraEditor on Unity 4.6+.
  • Fixed a Array initialization issue introduced with the changes to the Collection attribute.
  • Fixed a ComponentMonoBehaviour destruction issue. Even while not referenced, the instance would fail to be destroyed.
  • Fixed a collection failing to raise the Erase event on ComponentMonoBehaviour.
  • Fixed a issue when a Dictionary would contain ComponentMonoBehaviour and would destroy them even when it shouldn’t.
  • Fixed a 4 pixels layout issue when multiple nested object would be part of a parent collection.
  • Fixed an issue where multiple nested instance of the same type would prevent the child node from being expandable.

Hey, I have a question about the ActionBinding example.
You use ActionBinding(new Type[] { typeof(Material) });

From what I understand this will make the ActionBinding object to look only for methods with the same parameter signature. Is this correct?
I ask because I get loads of methods in the list, instead of just 1.

It just means that you declare that you will pass a material in your internal invoke. It displays every method that has this signature, or a smaller one.

Let’s say you do;

ActionBinding(new Type[] { typeof(Material), typeof(Rect) });

It would display all the following methods;

    public void Method1() { }

    public void Method2(Material material) { }

    public void Method3(Material material, Rect rect) { }

Extra parameters are truncated when invoked.

Frankly, ActionBinding was more an example of what could be done than anything else. This specific class needs lot of love right now. I have a list of bugs in it that I need to look into.

For example right now, the previous signature would allow you to select the following method;

public void Method4(Material material, Rect rect, Texture texture)

And to flag the last parameter as internal, which would make the invoke fail. The extra not-declared parameter should always be static or external.

It would be also interesting to merge Get/Set method into a single entry.

Hey, thank you for the info. It helped a lot!

Also, one more question :). In the Inspector i have already added one element in the ActionBinding array. I add another element with the + sign and try to copy the 1st element over the 2nd with drag&drop, but I get the following error

 StackOverflowException: The requested operation caused a stack overflow.
AdvancedInspector.InspectorField.DeepComponentCopy (UnityEngine.MonoBehaviour owner, System.Object value) (at c:/Users/LightStriker/Desktop/AdvancedInspector/AdvancedInspector/AdvancedInspector/AdvancedInspector/InspectorField.cs:1595)

Thanks for spotting that, I’ve been able to reproduce it.

It appears to be the case only if you’re targeting the script that holds the ActionBinding, creating a loop within itself while trying to deep copy the ActionBinding instance.

I’ll issue a fix for that in 1.42.

1.41 is now available on the Asset Store.

Hello LightStriker,

Bought your asset and… WOW!
Great tool, i use it extensivly now, especially Inspect(“isVisible”) and ComponentMonoBehaviour.
(using unity 4.5 and 4.6beta)

I do have some questions though;
(I separated them in features and bug?)
Would you look into them?
In the mean time, keep up the good work!!!


feature:

CreateDerived
Is it possible when only one (concrete) class exists, an instance is directly created,
instead of having to manually choose the single existing class by the ‘+’ sign.

SpaceAttribute
Possibility to add before AND after spacing;
E.g. [SpaceAttribute(10,10)]

snap
Now only works when attribute Angle is used.
Is it possible to implement the same feature for normal int / float fields also???
E.g. [RangeValue(0,10,2)] where the 2 means increase / decrease value with 2

hidescript
Show / hide scriptname also possible for ComponentMonoBehaviour?
E.g. Expandable(false,true) //hide scriptname, InspectDefaultItems is true.

tested, didn’t work (for me…)
[AdvancedInspector(false), Expandable(InspectDefaultItems = true)]
abstract public class BLA : ComponentMonoBehaviour

tab:
Possible to show / hide tabs?
E.g. like [Inspect(“isFieldVisible”)] we do: [Tab(myTabs.TAB01, “isFieldVisible”)]

Possible to use Descriptor in tabs?
E.g. Usage I want to change color of tab when value of some field on the respective tab
isn’t correct.

collection
Possible to insert/remove items when displayed as DROPDOWN or BUTTON?


bug?

  • When using attribute Tab , attribute Inspect must also be used, otherwise no tabs are shown in the inspector.

  • I have a fairly complex GameObject , consisting of many ComponentMonoBehaviour instances.
    When i start play when the GameObject props are shown in the inspector i get
    stack overflow exceptions ;

StackOverflowException: The requested operation caused a stack overflow.

AdvancedInspector.BehaviourEditor.Referenced (System.Object owner, AdvancedInspector.ComponentMonoBehaviour target, Boolean recursive)

AdvancedInspector.BehaviourEditor.Referenced (System.Object owner, AdvancedInspector.ComponentMonoBehaviour target, Boolean recursive)

AdvancedInspector.BehaviourEditor.Referenced (System.Object owner, AdvancedInspector.ComponentMonoBehaviour target, Boolean recursive)
etc…

Due to the complexity i can’t put my finger on the exact spot causing this exception and i haven’t been able to reproduce it with an simple example neither.

Greetz G