Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Advanced Inspector - Never Write An Editor Again

Discussion in 'Assets and Asset Store' started by LightStriker, May 4, 2014.

  1. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    Great, thanks for the fast response LightStriker! Just an idea, could add an "artist" view-mode like you already have basic/advanced/debug etc.
     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    And what would an "artist" view do?
     
  3. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    hide the re-order and remove buttons. Different view-mode seem more intuitive than adding " [Size (false)]" to everything.
     
  4. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    hey I used that great idea you had in another thread for displaying the name of an item in a list of custom-classes. Override ToString() and return the name string. Works great, a bit like how adding "public string name" in the default inspector would name array items.

    Is there any way to make the name display on the left where the "[0]" is, instead of on the right?
     

    Attached Files:

  5. Essential

    Essential

    Joined:
    Sep 8, 2011
    Posts:
    265
    I see your point but I think a lot of artists in other projects would need access to the reorder and remove controls for certain elements, so what happens in those situations? Though perhaps a flag [showInArtistView] could solve that.
     
  6. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    Really? You got some weird artist on your projects if they never have to handle lists in any way.
    Frankly, at that point, I have the feeling what you are more looking for is a global option specific to locking collection, instead of shoehorning that feature into another system.

    Maybe an option in the contextual menu?



    The issue I see if I was to do that is when displaying dictionaries. The value between the [] is not a number, but a key, and can be really long already.
     
  7. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    thanks light striker, something in the contextual menu was exactly what I was looking for! cheers! Is this a feature in the next update or something?
     
  8. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    is there some way to override what advanced-inspector displays in that bit? (where the [0] is)
     
  9. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    Yes, it's already coded and will be in the next version. The next version is taking a lot of time because of some features requested that are really not straight forward... Like the ability to only display one item from a collection at a time. You can see from my last image that the second "list" has a drop down menu on the right. On top, I'm writing extensive tutorials for newcomers. (Like "How to save and display Type")

    There's also the ability to color the background;



    Not currently. In the case of a dictionary, the "key" displayed in between the "[]" is the ToString overload. In case of a IList (array/arraylist/list), the value displayed is the index. I think removing the [0] could become very confusing very quickly. However, text could always be added next to it. Now just need to find the proper, cleanest way to do that.
     
  10. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    awesome man thanks for that, looking forward to the update!
     
  11. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    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.
     
    Last edited: Aug 18, 2014
  12. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    sounds great, can't wait!
     
  13. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    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.
     
  14. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    any way to control indentation like for arrays etc?
     
  15. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    What do you mean?
     
  16. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    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.
     
    Last edited: Aug 21, 2014
  17. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    Ah! I understand. No, right now there is no such thing. I'll look into it.
     
  18. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    great, thanks!
     
  19. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    Version 1.4 is now available.
     
  20. Mishaps

    Mishaps

    Joined:
    Nov 28, 2011
    Posts:
    181
    great. thanks for the update!
     
  21. MacBug

    MacBug

    Joined:
    Jun 12, 2013
    Posts:
    1
    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
     
  22. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    847
    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?
     
  23. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    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;

    Code (CSharp):
    1. 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.
     
  24. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    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.
     
  25. mboog12

    mboog12

    Joined:
    Oct 4, 2011
    Posts:
    80
    Hey, I have a question about the ActionBinding example.
    You use
    Code (CSharp):
    1. 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.
     
  26. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    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;

    Code (CSharp):
    1. ActionBinding(new Type[] { typeof(Material), typeof(Rect) });
    It would display all the following methods;

    Code (CSharp):
    1.     public void Method1() { }
    2.  
    3.     public void Method2(Material material) { }
    4.  
    5.     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;

    Code (CSharp):
    1. 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.
     
  27. mboog12

    mboog12

    Joined:
    Oct 4, 2011
    Posts:
    80
    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
    Code (CSharp):
    1.  StackOverflowException: The requested operation caused a stack overflow.
    2. AdvancedInspector.InspectorField.DeepComponentCopy (UnityEngine.MonoBehaviour owner, System.Object value) (at c:/Users/LightStriker/Desktop/AdvancedInspector/AdvancedInspector/AdvancedInspector/AdvancedInspector/InspectorField.cs:1595)
     
  28. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    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.
     
  29. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    1.41 is now available on the Asset Store.
     
  30. gpvd

    gpvd

    Joined:
    Nov 2, 2013
    Posts:
    78
    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
     
  31. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    Oh, lot of question!

    CreateDerived
    An instance is not created automatically because there is no way to know if you won't add a new derived class at some point. Also, there is even place where you would like this field to stay empty (null). For example, I have a composition-driven camera system, and there's a "shaker" field. So far, I only have 1 type of shaker, but I'll maybe write more later. I would hate if all my camera would have a shaker showing up by default.

    SpaceAttribute
    I'll add a constructor taking (int, int) in the next version. As for now, you can easily do [Space(Before = 10, After = 10)].

    Snap
    Sure, it shouldn't be very hard. I'm adding it to the short list, thanks for the idea!

    Hidescript
    I just tried [AdvancedInspector(false)] on AIExample_ComponentA in the examples and it works just fine. My mistake for using Expendable in the examples.

    Tab
    Hmm... I was about to say "Sure, just use IsVisible on Inspect and if there is no item the tab will be hidden", but I just discovered the Tab code ignore the visibility flags. So right now, there is no way to show/hide items in a tab. I'll fix that in the next version.

    EDIT: Hmm... Currently tabs aren't hide-able because of how they are bound to the definition of an enum. So adding a way to hide one might not be as straight forwards as I first thought.

    Descriptor In Tab
    Right now descriptor works fine in tabs - see the Tab example in the package, you can change name or even put an icon - however, it doesn't take the color argument into account. Adding that to the list!

    EDIT: Actually, I cannot add coloring to a tab, because of how "Toolbar" GUI works. I would have to drop using it and build a custom GUI to replace it. It's just say I don't feel like launching myself into that just yet.

    Collection
    You should be able to remove item using the "-" sigh at the far right of the button/dropdown, no? Sadly, you cannot delete an item and make an empty field from it. I'm not sure how interface-wise that could work. Would I need two "-", one for deleting the item, and one for the index?

    "- When using attribute Tab , attribute Inspect must also be used, otherwise no tabs are shown in the inspector."
    So far, that's true, as the tab is a modifier over the inspect behaviour. It's the same way with "Group" or "Toolbar" as it's the Inspect attribute that drives if an item is visible or not.

    Stack Overflow
    From what I read here, you have a self-referencing loop using ComponentMonoBehaviour. You have a MonoBehaviour A that targets a Component B that in turns target A. (A => B => A) I would usually say it's a bad design for the component to be able to target its parent this way, but it's obvious it shouldn't create an overflow. I'll fix that in 1.42.

    EDIT: Actually... I shielded that part against stack overflow in 1.41... And from your trace, you have that version. Very weird. I'll look into it deeper.

    Thanks a lot for the comment and ideas!
     
    Last edited: Sep 10, 2014
  32. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    Change list for version 1.42 grew a bit;

    • Added a new interface; "ICopy" which give an object the power to handle how it should be copied over a targeted field.
    • Added a new interface; "ICopiable" which allows an object to decide if it can be copied or not over a targeted field.
    • The Inspector now takes the .NET ICloneable interface into account, allowing it to handle the copying. ICopy take priority over ICloneable.
    • Fixed a recursive stack overflow in the copy/paste of a self-referenced object.
    • Fixed a stack overflow in prefab comparaison with self-referenced object in editor mode.
    • Added a "Take Screenshot" option in the Camera editor. It's available in advanced mode.
    • The Collection attribute was missing the IRuntimeAttribute interface declaration.
    • ActionBinding now properly sorts out properties, ignoring Getter when a Set is needed and vise versa.
    • ActionBinging now flags Binding Parameter that are extra - not declared in the constructor - as being external or static, never internal.
    • ActionBinging now control if it can be copied over, and what is copied. Same thing for BindingParameters. See ICopy/ICopiable.
    • Fixed an issue when reloading the assembly context where Unity would "hang" for a few second while the Inspector rebuilds the type hierarchy tree.
    • Added a missing construction in the Space Attribute.
    • Fixed the stack overflow in the ComponentMonoBehaviour... again! What was I drinking?
    • Fixed a object array initilization issue when using Collection(0) and a inlined field initialization.
    • AnimatorEditor no longer display items twice.
    • Added to the AdvancedInspector namespace the following; Toolbox, ModalWindow, WindowResult, IModal.
    • The modal window are now draggable.
    • Fixed the expansion of collection in Button mode.
    Modal window are now draggable;



    In Advanced mode, the Camera inspector now has a "Take Screenshot" button and a "Screenshot Resolution" setting. People I work with found out taking screenshot in non-standard resolution to be annoying. For example, an iPad Air is 2048*1536, which most screen cannot handle. This option allows you to take a screenshot in any resolution you wish!



    1.42 have been submitted to the Asset Store and should be available within the week.
     
  33. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    1.42 is now available.
     
  34. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    In the next version (1.43), if you have a 5-buttons mouse, you will be able to "browse" your selection history using the back/forward mouse buttons, similar to how you go back or forward in a web browser.
     
  35. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    An issue have been found in version 1.42 that prevents groups from being expanded. A quick-fix version have been submitted (1.42b). It should be on the Asset Store in a few days.

    If you have this issue and need it fixed right away, contact me at admin@lightstrikersoftware.com, and I'll supply you with the fixed package.
     
  36. gpvd

    gpvd

    Joined:
    Nov 2, 2013
    Posts:
    78
    Hello,

    Nice update, i do have a little feature request;

    Is it possible to add an attribute for selecting ONLY scene objects; e.g DontAllowPrefab or AllowSceneObjectOnly ?

    Tnx for the great package!!!

    greetz,
    G
     
  37. mboog12

    mboog12

    Joined:
    Oct 4, 2011
    Posts:
    80
    Heya,
    I have another issue :). I'm using this code :
    Code (CSharp):
    1. [System.Serializable, Expandable]
    2.     public class ActionsDictionary
    3.     {
    4.         [Inspect, SerializeField] public string ActionName;
    5.         [Inspect, SerializeField, CreateDerived] public CostFunction CostFunction;
    6.     }
    7.  
    8.     [Inspect, SerializeField]
    9.     public ActionsDictionary[] Actions;
    I want to create an array of ActionsDictionary objects. In this array I link action names to derived classes of CostFunction. The problem is that CostFunction variables get set to null after hitting play.

    LE: If I add [System.Serializable] to class CostFunction then I cannot create a derived class in the inspector.
     
    Last edited: Sep 28, 2014
  38. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    I would love that, but sadly this is an issue with the Object Selector window - the window you invoke to select an object. It doesn't have a parameter to not show the assets/prefabs.
     
  39. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    Is CostFunction deriving from ComponentMonoBehaviour? Can you post the code of this class here?
     
  40. mboog12

    mboog12

    Joined:
    Oct 4, 2011
    Posts:
    80
    I'm not deriving the class from ComponentMonoBehaviour. This is my code :
    Code (CSharp):
    1. public class CostFunction
    2. {
    3.     protected Unit _unit;
    4.     public virtual float GetCost(Node source, Node destination) {return 1;}
    5.     public virtual bool IsValid(Node source) {
    6.         return true;
    7.     }
    8. }
     
  41. gpvd

    gpvd

    Joined:
    Nov 2, 2013
    Posts:
    78
    Mmm, Thats a pity,
    Ok, thanks for looking into it.

    Greetz,
    G
     
  42. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    When you use CreateDerived, your field type should always derive from ComponentMonoBehaviour, otherwise it revert to its base type on a context reload.
     
  43. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    I was just wondering if interfaces would be exposed properly. Since the Advanced Inspector does not uses SerializableObject or SerializableProperty, it doesn't have the issue of being limited to displaying what Unity is able to serialize or not.

    So, without modification;
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. using AdvancedInspector;
    5.  
    6. [AdvancedInspector]
    7. public class AIExample_Interface : MonoBehaviour
    8. {
    9.     [Inspect, CreateDerived]
    10.     public IMyInterface ExposedInterface
    11.     {
    12.         get { return serializableReference as IMyInterface; }
    13.         set { serializableReference = value as UnityEngine.Object; }
    14.     }
    15.  
    16.     [SerializeField]
    17.     private UnityEngine.Object serializableReference;
    18. }
    19.  
    20. [Expandable]
    21. public interface IMyInterface { }
    Yup! It works. Just added the AttributeTargets.Interface to the Expandable attribute, et voilà!
    Of course, you should not make classes that are not UnityEngine.Object with that interface, otherwise Unity won't be able to save it properly.

    Also, a feature requested for 1.43;

    Code (CSharp):
    1.     [Inspect, Method(MethodDisplay.Invoke)]
    2.     private void CustomMethodDraw()
    3.     {
    4.         GUILayout.Label("This text is drawn directly from an invoked method.");
    5.     }


    Instead of exposing a button, like other inspected method, this one invokes it on inspector draw. So you can draw whatever you want on the Inspector without writing any custom editor/property drawer.
     
    Last edited: Oct 5, 2014
  44. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    The version 1.43 have been submitted with the following changelist;

    - Fixed an expansion bug with groups.
    - Fixed an expansion bug with multi-edition of collection and dictionary.
    - Fixed an issue that would prevent ExternalEditor list from being sortable.
    - Added the compile define ADVANCED_INSPECTOR to detect if the tool is installed or not.
    - SHIFT+DRAG on labels of integer or float to "scroll" the value.
    - DOUBLE+CLICK on labels expends or collapsed the item if it's expandable.
    - DescriptorAttribute is now taken into account when afixed to an enum's value.
    - The CollectionAttribute now has a "Enum Type" properties, which binds a collection to an enum's names. See the documentation for an example.
    - Fixed an invalid index when a small array is turned bigger using the CollectionAttribute size property.
    - Added missing attribute targets in a few Attribute so they could be added to structs.
    - New Attribute; MethodAttribute, which gives control on how a method is invoked or displayed. For example, you can replace the botton and draw whatever you want.
    - ExternalEditor got more control over how it can be drawn; fixed separator or no space reserved for expander.
    - The separator in the ExternalEditor is now uncoupled from the separator in the Inspector. Previously they shared the same settings.
    - Transform's global position/orientation are not read only anymore, and accessible in Advanced mode instead of Debug.
    - Expandable attribute can now be placed on Interfaces. See AIExample_Interface for an example of an implementation.
    - CollectionDisplay "default" value have been renamed to "List", to better reflect what it does.
    - UnityEngine.Component that implement an interface can now be properly drag and dropped in a field of that interface type. See AIExample_Interface.
     
  45. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    Version 1.43 is now available on the AssetStore.
     
  46. zee_ola05

    zee_ola05

    Joined:
    Feb 2, 2014
    Posts:
    166
    Hi! Does this support serialization of Interfaces, like the one FullInspector does?

    Edit: Looks like it does. Should have backread. However, I don't like the way you need to use Unity.Object to serialize it.
     
    Last edited: Oct 12, 2014
  47. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    It doesn't change how Unity serialize anything. However, unlike Unity, it is bound by reflection instead of serialization.

    For this reason, you can inspect properties or methods and use them as a conversion bridge for interfaces. However, let's be known that Unity's object selector is unable to find interfaces, so for now the only two way to setup an interface in a field is by drag and drop, or with Advanced Inspector's picking tool.

    The goal here is to give enough tools from attributes and interfaces to control exactly how your data is inspected, without ever writing a custom editor or a property drawer.

    I would say the biggest difference between Advanced Inspector and Full Inspector is that one about user interface - copy/paste, picking tool, endless inlining, dynamic array size, etc. - while the other is about the serialization - interface, generics, etc. Since they are not about the same thing, it's maybe possible to make them work together.

    EDIT: I've just tried importing both asset in the same project and it works fine. However, making them work on the same object might not be as easy. FI supports stuff AI doesn't, and AI supports stuff FI doesn't, mostly because of the different scopes.
     
    Last edited: Oct 13, 2014
  48. Zoey_O

    Zoey_O

    Joined:
    Mar 15, 2013
    Posts:
    28
    Is there a way to decorate a base class with the AdvancedInspectorAttribute and have its properties used? It looks like it only checks the class instance (not the inheritance tree) for the AdvancedInspectorAttribute for determining if it should display the inspector, and then uses whatever values that has for show script or inspecting by default.

    It would be nice if I could define in the attribute of a base class that I wanted the values for this attribute to be inherited, and only change if I override them in a child class. This includes not having to add the attribute to the child class at all if I'm not changing it, so its presence in the base class would be enough to trigger the Advanced Inspector rendering, and its values would be used. I'd also be ok if I had to put an extra value or attribute to signal that I wanted the inheritance, for backwards compatibility, vs it just doing this by default.

    I can get by for now by just decorating all the instances with the attribute and the values I want, it just makes it slightly more annoying to go in and change it, and remember to do so when I'm creating derived classes.
     
  49. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,715
    That should already...

    Code (CSharp):
    1. type.GetCustomAttributes(typeof(AdvancedInspectorAttribute), false);
    Doh!

    Code (CSharp):
    1. type.GetCustomAttributes(typeof(AdvancedInspectorAttribute), true);
    Well, that's embarrassing.

    If you need a build right away with this modification, just contact me at admin@lightstrikersoftware.com, and I'll send you it.
     
  50. Zoey_O

    Zoey_O

    Joined:
    Mar 15, 2013
    Posts:
    28
    I do not need it right away, it can wait until a future build. My next question/issue is

    I have a MonoBehaviour that I implemented IDataChanged on. I see the events firing, and I'm raising the event, but its not updating my list field until I either expand/collapse the list or click off then back onto the MonoBehaviour. It seems like this is why the IDataChanged interface is there, so let me know if I'm doing something wrong or using it incorrectly.

    Edit: I'm clicking the Execute button that Advanced Inspector renders to fire the code.

    Code (CSharp):
    1. using System.Collections.Generic;
    2.  
    3. using AdvancedInspector;
    4.  
    5. using UnityEngine;
    6.  
    7. [AdvancedInspector]
    8. public class DataChangedTest : MonoBehaviour, IDataChanged
    9. {
    10.     [Inspect]
    11.     public List<int> list;
    12.  
    13.     public event GenericEventHandler OnDataChanged;
    14.  
    15.     public void DataChanged()
    16.     {
    17.         Debug.Log("DataChanged called");
    18.     }
    19.  
    20.     [Inspect]
    21.     public void Execute()
    22.     {
    23.         if (this.list == null)
    24.         {
    25.             this.list = new List<int>();
    26.         }
    27.  
    28.         this.list.Add(this.list.Count);
    29.  
    30.         if (this.OnDataChanged != null)
    31.         {
    32.             this.OnDataChanged();
    33.             Debug.Log("Called OnDataChanged");
    34.         }
    35.     }
    36. }