Search Unity

Advanced Inspector - Never Write An Editor Again

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

  1. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Sure... Instead of deriving from Editor, derive from Advanced Inspector class "InspectorEditor".

    If you're not overriding OnInspectorGUI and only OnSceneGUI, it should work just fine.

    If you're overriding the method OnInspectorGUI, you can simply call the base method (base.OnInspectorGUI), or you can call DrawAdvancedInspector(), which is the Advanced Inspector version of Unity's DrawDefaultInspector().
     
  2. Oriam

    Oriam

    Joined:
    Nov 11, 2012
    Posts:
    23
    Oh that's nice. Great product.

    Thank you very much.
     
  3. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    Hey LightStriker,

    I was toying around with "Advance Inspector" and found to missing features that are already in the default Unity's inspector. The first one is the ability to move around the inspector using the arrow keys. This is special useful when inspecting arrays, so you can fold/unfold quickly. The other missing feature which is really important (IMO) is the ability to drag&drop a multiple selected objects at the same time to a List/Array field. In the normal Unity flow you lock the inspector, then make the multiple selection and drag&drop it to the desired field. In this way you can easily populate list. Is this possible in "Advance inspector"?

    Thanks in advance
     
  4. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I'll look into the arrow keys thing... It's something I never used before.

    The multi-selection to array is supposed to be working fine. Do you have a situation where it does not?
     
  5. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    Ah sorry, I forgot to mention that in "Advance inspector" the drag&drop feature only works with GameObject[]. If you have any other type (like Collider[], or Light[] ) it doesn't work.

    Another thing not related with this is some dangerous results that "Advance inspector" could lead into. If Unity adds a new field to a component and this component is being override by "Advance Inspector" you would not realize that there is a new field there.


    Thanks for taking a look into it.
     
    Last edited: Apr 16, 2015
  6. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    One other thing: What if I like to have my custom editor working also with "Advance Inspector"? In the documentation says that if you use a custom inspector it has preference over Advance Inspector. But what if I just want to add a button to my inspector but conserve all the decorators of Advance Inspector. Is that possible? I don't want to go thought the path of [Inspect, Method(MethodDisplay.Invoke)] because this adds unwanted logic to the main class install of and inspector one.
     
  7. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Odd. I'm trying it now on the latest version, and it's working... almost fine. I'm getting an exception thrown when hovering on an invalid type. That will be fixed in the next version, but you should be able to drag component properly with the current (1.54) version.

    As for the new fields... I'm fully aware of that. There's some code in AI that pop warning if it tries to read deprecated values. As for totally new fields, I know it's a potential risk. Since I'm working daily with Unity, I would expect to spot those rather quickly. You can also turn off specific Editor if you wish from the Preferences panel.

    Yes, there's ways for that. You can take a look - and modify whatever you wish - in the Plugins/Editor/AdvancedInspector/ folder. You should take a look into the folders FieldEditors, which is a class that defines how AI draws the right side of the inspector. For example, you have FloatEditor.cs that handles all floating-point numbers, or more specific, you have DateTimeEditor.cs that handles the drawing of a calender.

    You can create as many FieldEditor as you wish, and you can bind them to any types. AI - since 1.53 - also support type-bound PropertyDrawers the same way Unity does.

    It would help if I would know more precise situation that you need.
     
  8. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    Let me explain me better. I have this class:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using AdvancedInspector;
    4.  
    5.  
    6. public class MyClass : MonoBehaviour {
    7.  
    8.     [Range(0,10)]
    9.     public float variable1;
    10.    
    11.     [Background(0.7f,0,0,1)]
    12.     public string[] variable2;
    13.    
    14.     // Update is called once per frame
    15.     void Update () {
    16.         //Game Logic here
    17.     }
    18. }
    And I want to add a custom inspector which adds only a button, but I want to keep the [Background] and [Range] decorator. Here is my custom inspector:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEditor;
    4.  
    5. [CustomEditor(typeof(MyClass))]
    6. public class MyClassCustomEditor : Editor {
    7.  
    8.     public override void OnInspectorGUI()
    9.     {
    10.        
    11.         base.DrawDefaultInspector(); //I want to use the Advance Inspector, to draw variable1 and variable2
    12.        
    13.         MyClass myTarget = target as MyClass;
    14.        
    15.        
    16.         if(GUILayout.Button("My button"))
    17.             Debug.Log("Do something");
    18.        
    19.     }
    20. }
    I won't like to add any button legit to MyClass, so, is this possible?

    About the other thing of drag&drop, now is working. I don't know what I was doing before. Sorry for that.
     
  9. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Oh! Didn't understand. It's easy, derive from InspectorEditor instead of Editor, and do;

    Code (CSharp):
    1.         public override void OnInspectorGUI()
    2.         {
    3.             base.OnInspectorGUI();
    4.  
    5.             if (GUILayout.Button("This is a button."))
    6.                 DoSomething();
    7.         }
     
  10. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    148
    Ok great. It works perfectly.

    Many thanks
     
  11. Shudrum

    Shudrum

    Joined:
    Apr 3, 2011
    Posts:
    63
    Hi !

    Currently working with my 3d models, I have many many many many warnings, always the same :

    Code (csharp):
    1. Advanced Inspector is inspecting an obsolete member; uv1 on type Mesh
    2. UnityEngine.Debug:LogWarning(Object)
    3. AdvancedInspector.InspectorField:.ctor(InspectorField, Type, Object[], MemberInfo, Attribute[])
    4. AdvancedInspector.InspectorField:.ctor(Type, Object[], MemberInfo, Attribute[])
    5. AdvancedInspector.MeshEditor:RefreshFields() (at Assets/Plugins/Editor/AdvancedInspector/UnityTypes/MeshEditor.cs:27)
    6. AdvancedInspector.InspectorEditor:set_Instances(Object[])
    7. AdvancedInspector.InspectorEditor:OnEnable()
    8. UnityEditor.HostView:OnGUI()
     
  12. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Very simple... You're probably on version 1.53, and should update to 1.54. :)
     
  13. Shudrum

    Shudrum

    Joined:
    Apr 3, 2011
    Posts:
    63
    I'm sorry but ...

    I have the latest version, downloaded on a test project just 3 / 4 hours before.

    Good luck and thank you !
    (Sorry for the quick and direct previous message, was very tired ^^)
     
  14. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    The other possibility is that you're trying to run the Unity 4.3 or 4.6 version on Unity 5.0... Which has different Mesh definition.

    Can you go in Preferences > Adv. Inspector and tell me the full version listed there?
     
  15. Shudrum

    Shudrum

    Joined:
    Apr 3, 2011
    Posts:
    63
  16. Shudrum

    Shudrum

    Joined:
    Apr 3, 2011
    Posts:
    63
    Maybe it can help :

     
  17. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Damn... I guess this specific files didn't go in the latest version. The warning has no impact, but if you want to get rid of it, you can replace MeshEditor.cs with the following;

    Code (CSharp):
    1. namespace AdvancedInspector
    2. {
    3.     [CanEditMultipleObjects]
    4.     [CustomEditor(typeof(Mesh), true)]
    5.     public class MeshEditor : InspectorEditor
    6.     {
    7.         protected override void RefreshFields()
    8.         {
    9.             Type type = typeof(Mesh);
    10.  
    11.             fields.Add(new InspectorField(type, Instances, type.GetProperty("subMeshCount"),
    12.                 new DescriptorAttribute("Sub Mesh Count", "The number of submeshes. Every material has a separate triangle list.", "http://docs.unity3d.com/ScriptReference/Mesh-subMeshCount.html")));
    13.             fields.Add(new InspectorField(type, Instances, type.GetProperty("vertices"),
    14.                 new DescriptorAttribute("Vertices", "Returns a copy of the vertex positions or assigns a new vertex positions array.", "http://docs.unity3d.com/ScriptReference/Mesh-vertices.html")));
    15.             fields.Add(new InspectorField(type, Instances, type.GetProperty("triangles"),
    16.                 new DescriptorAttribute("Triangles", "An array containing all triangles in the mesh.", "http://docs.unity3d.com/ScriptReference/Mesh-triangles.html")));
    17.             fields.Add(new InspectorField(type, Instances, type.GetProperty("uv"),
    18.                 new DescriptorAttribute("UV", "The base texture coordinates of the mesh.", "http://docs.unity3d.com/ScriptReference/Mesh-uv.html")));
    19.             fields.Add(new InspectorField(type, Instances, type.GetProperty("uv2"),
    20.                 new DescriptorAttribute("UV2", "The second texture coordinate set of the mesh, if present.", "http://docs.unity3d.com/ScriptReference/Mesh-uv2.html")));
    21.             fields.Add(new InspectorField(type, Instances, type.GetProperty("uv3"),
    22.                 new DescriptorAttribute("UV3", "The third texture coordinate set of the mesh, if present.", "http://docs.unity3d.com/ScriptReference/Mesh-uv3.html")));
    23.             fields.Add(new InspectorField(type, Instances, type.GetProperty("uv4"),
    24.                 new DescriptorAttribute("UV4", "The fourth texture coordinate set of the mesh, if present.", "http://docs.unity3d.com/ScriptReference/Mesh-uv4.html")));
    25.             fields.Add(new InspectorField(type, Instances, type.GetProperty("boneWeights"),
    26.                 new DescriptorAttribute("Bone Weight", "The bone weights of each vertex.", "http://docs.unity3d.com/ScriptReference/Mesh-boneWeights.html")));
    27.             fields.Add(new InspectorField(type, Instances, type.GetProperty("colors"),
    28.                 new DescriptorAttribute("Colors", "Vertex colors of the mesh.", "http://docs.unity3d.com/ScriptReference/Mesh-colors.html")));
    29.             fields.Add(new InspectorField(type, Instances, type.GetProperty("normals"),
    30.                 new DescriptorAttribute("Normals", "The normals of the mesh.", "http://docs.unity3d.com/ScriptReference/Mesh-normals.html")));
    31.             fields.Add(new InspectorField(type, Instances, type.GetProperty("tangents"),
    32.                 new DescriptorAttribute("Tangents", "The tangents of the mesh.", "http://docs.unity3d.com/ScriptReference/Mesh-tangents.html")));
    33.             fields.Add(new InspectorField(type, Instances, type.GetProperty("bounds"),
    34.                 new DescriptorAttribute("Bounds", "The bounding volume of the mesh.", "http://docs.unity3d.com/ScriptReference/Mesh-bounds.html")));
    35.         }
    36.     }
    37. }
     
  18. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    Hey, @LightStriker, I've got another question.

    Would it be at all possible to add another parameter to the AdvancedInspector attribute that lets you set a default width of the label half of an AdvancedInspector Inspector?

    Some of my Inspectors end up with labels that are a bit to long for the default split, and having to re-drag the divider every so often is a bit annoying. I've no idea if it's even plausible, but it'd be a huge productivity boost if I can just override the default Inspector split when I'm tagging my custom classes with the AdvancedInspector attribute.
     
  19. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I'm not sure to understand what you mean... You would want to change where the divider is when inspecting specific classes? Have you tried putting your label on more than one lines?
     
    Last edited: Apr 27, 2015
  20. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    Pretty much, yes. I just wanted to change where the divider starts (so I can specify a starting width or something -- essentially just push it to the right a bit more).

    I haven't tried splitting my labels up. Is there an easy way to do that? I have a feeling it'll look kind of bad, though, as it'll end up taking up more vertical space than usual -- especially as I can solve the problem by just dragging the divider over a little bit.
     
  21. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717


    Code (CSharp):
    1.     [Inspect, Descriptor("This is a very \nvery very very \nvery *deep-breath* \nlong variable name.", "")]
    2.     public float myFloat;
    Using the \n character.
     
  22. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    Ah, alright. Yeah, I guess that works, but it looks kind of sloppy as it just takes up extra vertical space. I guess I can keep dragging the divider around whenever I need to read on of the slightly-too-long labels.

    Thanks, though! I might need the label splitting later.
     
  23. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    @LightStriker
    Lately, every time I open my Unity project, I get the following error:
    TypeLoadException: Could not load type 'AdvancedInspector.WatchWindow' from assembly 'AdvancedInspector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

    I don't get the error on a fresh project so it could be caused by something else in my project. But I have no issues otherwise. Do you have any idea why AdvancedInspector might be showing this error?

    EDIT
    Well, just for fun, I moved the Plugins/Editor/AdvancedInspector folder out of the Plugins folder into Tools/Editor/AdvancedInspector and it fixed the problem.

    Is there a reason the Editor code was in the Plugins folder?
     
    Last edited: Apr 28, 2015
  24. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Yes... except giving me headache; it's so that the Advanced Inspector could work with UnityScript and Boo. If you are not using UnityScript or Boo, you can drag everything out of the plugin folder and make the whole thing simpler.
     
  25. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Version 1.55 have been submitted to the Asset Store with the following changes;

    • Added an extra description in Group attribute; this shows up on the right of the separator.
    • Fixed a null in watched/saved references.
    • Fixed a conversion exception while dragging the label of a ranged float.
    • Fixed a cast exception while dragging a component on a collection.
    • Fixed an issue while nesting lights, animator, animation and a few other component types.
    • Fixed the UV1 warning on Unity 5 meshes.
    • Fixed Inspect attribute condition property. It was simply not working.
    • Fixed Restrict attribute, for some reason it was ignoring null values.
    • Allow overriding OnDisable of InspectorEditor.
     
  26. Daniel-F

    Daniel-F

    Joined:
    May 15, 2013
    Posts:
    26
    Just letting you know: If I create an expandable ComponentMonoBehavior using code similar to that described here, and use it in an array, then remove an element from the array and press Undo/Ctrl-Z, the removed element is not restored and I receive a huge number of warning messages if I try to do anything with the array in the inspector from then on. (Switching to another GameObject and back seems to stop the continuing problems.)
     
  27. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I'm not getting any warning or error in the latest version, however it does not undo properly. I'm looking into it.
     
  28. Daniel-F

    Daniel-F

    Joined:
    May 15, 2013
    Posts:
    26
    Thanks. Unrelated, but I'm also getting hundreds of these warnings when viewing a Rigidbody in 5.0.1p3:

    Code (CSharp):
    1. GetUseConeFriction always returns false. Cone friction is no longer supported, see getFrictionModel instead
    2. System.Reflection.MonoProperty:GetValue(Object, Object[])
    3. AdvancedInspector.InspectorField:GetValue(Object)
    4. AdvancedInspector.InspectorField:GetValue()
    5. AdvancedInspector.InspectorField:GetValue()
    6. AdvancedInspector.InspectorReference:.ctor(InspectorField)
    7. AdvancedInspector.InspectorPersist:Contains(InspectorField)
    8. AdvancedInspector.AdvancedInspectorControl:DrawLabel(FieldEditor, InspectorField, Boolean)
    9. AdvancedInspector.AdvancedInspectorControl:DrawNode(InspectorEditor, InspectorField, Boolean, Boolean)
    10. AdvancedInspector.AdvancedInspectorControl:Draw(InspectorEditor, InspectorField, List`1, Boolean, Boolean, Boolean)
    11. AdvancedInspector.AdvancedInspectorControl:Inspect(InspectorEditor, List`1, Boolean, Boolean, Boolean, Separator)
    12. AdvancedInspector.AdvancedInspectorControl:Inspect(InspectorEditor, List`1, Boolean, Boolean)
    13. AdvancedInspector.InspectorEditor:DrawAdvancedInspector()
    14. AdvancedInspector.InspectorEditor:OnInspectorGUI()
    15. UnityEditor.DockArea:OnGUI()
    16.  
     
  29. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Thanks, I'll update that. Hopefully it is not something they changed between 5.0.0 and 5.0.1...
     
  30. Daniel-F

    Daniel-F

    Joined:
    May 15, 2013
    Posts:
    26
    Ah, one more thing. I have an enum:

    Code (CSharp):
    1. [Flags]
    2. public enum DSpeaker {
    3.     Null=0,
    4.     Generic = 1<<0,
    5.     Radio     = 1<<1,
    6.     Sotka     = 1<<2,
    7. ...
    8. }
    And use it in the Inspector like so:

    Code (CSharp):
    1.     [Inspect]
    2.     [Enum(true)]
    3.     public DSpeaker requiredSpeakers;
    However, presumably because of the enumerator set to 0 (?), the value set in the inspector is shifted one bit further to the left than the original enum. Null results in 1, Generic results in 2, Radio results in 4 (1<<2), etc.

    It's also enabling every unused bit if "Everything" was enabled at some point earlier, but I guess that's probably intended functionality for the Everything setting, to allow for future additions to the enum.
     
  31. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Congratulation, you hit your nose on the EditorGUI.MaskedField bug I hate the most. Sadly, the only "solution" is to not explicitly declare a 0 value. My plan on longer term is to rewrite Unity's MaskedField to fix that.
     
  32. Daniel-F

    Daniel-F

    Joined:
    May 15, 2013
    Posts:
    26
    Ah, thanks for the explanation.
     
  33. seffles

    seffles

    Joined:
    Oct 2, 2013
    Posts:
    32
    I've got a small problem with a RangeInt member variable in v1.54. In the editor, it shows the label but no editable control. I'm declaring the member like this: "[SerializeField] [Range(1, 5)] private RangeInt m_NumSyllables = new RangeInt(1, 5);".

    I tried upgrading to 1.55 to see if it was fixed, but it gave me compiler errors about not being able to find IRuntimeAttribute.

    Any help with either of these issues would be greatly appreciated, thank you. :)

    Update: I've fixed it by using the "RangeValue" attribute instead of the "Range" attribute.
     
    Last edited: May 13, 2015
  34. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Yeah... RangeValue can be used on properties, unlike Unity's Range attribute.

    You had me searching, because the example was working fine here. So I was really wondering what was broken. :p
     
  35. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    Is there an easy way to show a warning if a field is not set in the inspector?

    I have something like this:
    Code (CSharp):
    1. public GameObject OtherObject;
    and it must be set to something in the inspector for the code to run properly. What I'd like to do is just add an attribute so that it shows a warning or error in the inspector if it's not set. Something like this:
    Code (CSharp):
    1. [RequireValue(HelpType.Error, "OtherObject value is required")]
    2. public GameObject OtherObject;
    I think I can do this with the Help attribute but it would require me to also write a delegate and I don't want to have to duplicate that in a bunch of classes. It seems like this might be a pretty useful feature.
     
    Last edited: May 20, 2015
  36. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Works if you're checking for a null... But what if you're checking for a negative value? Or an invalid character in a string? Or if the GameObject has the right name, layers or components?

    The path we choose with a delegate is for a good reason; there's simply too many cases to cover.

    However, if you would have the exact same message many time in many classes, we could maybe find a way to target a delegate from a unique static class.
     
  37. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    But you told me I'd never have to write another editor again :p.

    Generic solutions are a great option but if a situation comes up often enough, I think it's worth putting it in a common library. Maybe it's just my style but the situation does come up often and I've seen it in other libraries as well. Using a delegate from a static class would be good enough, though.

    Actually now that you mention it, "invalid character in a string" could easily be done with a RegEx match attribute. It wouldn't be a bad idea to include that in Advanced Inspector too!
     
  38. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Which is technically true... Writing a delegate that test a condition and may return a string for a help box is hardly an editor. :p

    And the Help attribute is just one that is using conditionals to know if it has to show or not something. Duplicating attributes into many version that each has different internal condition is not something I'm found of.

    So far, I'm leaning towards have a "Conditional Display" enum that define a series of generic condition like "Is Null, Is Positive, Regex, String is not empty, etc." and implement that logic in all attribute that can use it.

    So you would do something like;

    Code (CSharp):
    1. [Help(Conditional.IsNull, HelpType.Error, "Fill that field, you dummy!")]
     
  39. ishti10

    ishti10

    Joined:
    Jul 18, 2013
    Posts:
    9
    Hi. Thanks for your amazing plugin!

    I have a question:
    I wanted to sort the enum dropdown alphabetically instead of by its value. How can I do that in Advanced Inspector?
     
  40. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    I guess you're right :). I was thinking if I didn't want to duplicate code, though.

    Looks pretty good to me but you might run into complications with RegEx since it will require an expression parameter, which won't make sense for any of the other enums.
     
  41. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Snippet, with "using System.Linq;":

    Code (CSharp):
    1.     [Restrict("SortEnum")]
    2.     public MyEnum myField;
    3.  
    4.     private IList SortEnum()
    5.     {
    6.         return Enum.GetValues(typeof(MyEnum)).Cast<MyEnum>().OrderBy(x => x.ToString()).ToArray();
    7.     }
    8.  
    9.     public enum MyEnum
    10.     {
    11.         Potato,
    12.         Muffin,
    13.         Carrot,
    14.         Apple,
    15.         Juice,
    16.         Soup
    17.     }
    Gives;

     
  42. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    In the next version;

    Code (CSharp):
    1.     [Inspect, Help(HelpAttribute.IsNull, HelpType.Error, "Should not be null!")]
    2.     public Camera nullField;
    Where;

    Code (CSharp):
    1. public const string IsNull = "HelpAttribute.IsValueNull";
    and;

    Code (CSharp):
    1.         private static HelpAttribute IsValueNull(HelpAttribute help, object instance, object value)
    2.         {
    3.             if (value == null || (value is UnityEngine.Object && ((UnityEngine.Object)value) == null))
    4.             {
    5.                 return help;
    6.             }
    7.  
    8.             return null;
    9.         }
    Which gives;



    In short, all Runtime attribute can now receive a "method path". It's a path as "TypeName.NestedTypeName.StaticMethodName".

    The static method should follow the Template Static of the related attribute. The attributes pass down 3 arguments when invoking the bound delegate; itself, the object parent to the member, the member the attribute is on.
     
    Last edited: May 23, 2015
  43. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
  44. ishti10

    ishti10

    Joined:
    Jul 18, 2013
    Posts:
    9
    @LightStriker You're a lifesaver man. Thanks for the hard work!
     
  45. rosevelt

    rosevelt

    Joined:
    Oct 23, 2012
    Posts:
    47
    Hi,

    I'm trying to setup Visual Studio on a Mac using a VM.
    When adding a reference to the AdvanceInspector.dll and trying to use the decorator I'm getting an error:
    "AdvanceInspector" is not an attribute.
    As though it treat it as the namespace itself for some reason.

    Thanks
     
  46. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Because it is a namespace.

    Every class in Advanced Inspector is in the AdvancedInspector namespace to not pollute the global one.
     
  47. rosevelt

    rosevelt

    Joined:
    Oct 23, 2012
    Posts:
    47
    In the examples you seem to:
    using AdvanceInspector
    [AdvanceInspector]
    class...{}

    So what am I doing wrong?
     
  48. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    AdvancedInspector is both a namespace, and a class of an attribute inside that namespace. Yeah, it's maybe a fail from me to have named that class that way, the namespace coming later in the development.

    So you can't do [AdvancedInspector] or any other other attribute without have "using AdvancedInspector;"

    As stated in the documentation, the AdvancedInspector attribute is now totally optional, as the tool allow inspection of default serialized items the same way Unity does. So if you have the preference "Inspect Default Items" in the panel in Edit > Preferences... > Adv. Inspector selected, any of your class should be drawn by the Advanced Inspector.

    Feel free to contact me at admin@lightstrikersoftware.com if you need any help.
     
  49. rosevelt

    rosevelt

    Joined:
    Oct 23, 2012
    Posts:
    47
    Sent you a mail.
     
  50. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Version 1.56 have been submitted to the Asset Store with the following changes;
    • All IRuntimeAttributes can now target a static delegate using a "Class.NestedClass.Method" path to a static method.
    • Fixed an issue where protected member would fail to be inspected in default mode even when serialized.
    • Background attribute is now a dynamic attribute.
    • Fixed an issue with displaying AnimationCurves. Due to Unity limitation, it is impossible to change the curve's color.
    • Fixed an issue with field using Property Drawer nested inside non-Unity object.
    • Fixed an issue that would make Property Drawer fail in Unity 4.3.
    • Unity 5.0 no longer supported because of deprecation in EditorWindow definition. Now requires Unity 5.1+
    • Fixed the Watch window which would break down in Unity 5.1
    • Fixed obsolete values in RigidBody2D and Joint2D for Unity 5.1
    • For some reason Unity 5.1 dislike indexed PNG, which made some GUI image show as colored.
    IMPORTANT: Due to some unforeseen changes in Unity 5.1 in how some EditorWindow and Bitmap are handled, it is not possible to have a version that support both 5.0 and 5.1. Because there is no reason to stay on 5.0, as of version 1.56, Advanced Inspector no longer supports Unity 5.0. Let me know if there's some reason that would prevent you from upgrading to 5.1.

    For some reason Unity 5.1 is having issue with indexed PNG, displaying some bitmaps with some unwanted colors. If you find part of Advanced Inspector that are displaying such issue, please send me a screenshot.