Search Unity

Advanced Inspector - Never Write An Editor Again

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

  1. LunaTrap

    LunaTrap

    Joined:
    Apr 10, 2015
    Posts:
    120
    Hello I'm having problems, I turned off Draw Default Items in the preferences so Im the one that decided what to draw using AI

    But now it wont draw inspectors for classes

    Code (CSharp):
    1. using AdvancedInspector;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5.  
    6. [AdvancedInspector]
    7. public class NewBehaviourScript : MonoBehaviour
    8. {
    9.     [SerializeField, Inspect]
    10.     private TestClassTest test = new TestClassTest();  
    11. }
    12.  
    13. [System.Serializable, AdvancedInspector(true)]
    14. public class TestClassTest
    15. {
    16.     [SerializeField, Inspect]
    17.     private int TestFieldA;
    18.     [SerializeField, Inspect]
    19.     private int TestFieldB;
    20. }
    Draw Default Items turned off:



    With Draw Default Items turned on:

     
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Wow, my apologize for not answering. Sometime the forum doesn't warn me there's a new post.

    Draw Default Item is an old property that dates back to 1.2, when I made the switch of not displaying anything by default, to displaying the same stuff as Unity.

    What you're missing on TestClassTest is the [Expandable] attribute that allows AI to dig into an inner type.

    If you want faster answer, you can contact me on Discord or by email.
     
  3. LunaTrap

    LunaTrap

    Joined:
    Apr 10, 2015
    Posts:
    120
    Thanks a lot
     
  4. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    18
    Hello there!

    A quick question: any ETA or news about updating Advanced Inspector to use the Assembly Definition feature of 2017.3?

    https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html

    If I haven't missed it, the current version (1.72a) refers to the "C# assembly first-pass", which is no longer used if an unity project uses this new feature.

    Any ways to overcome this problem?? I would really love to make it work, because I use Advanced Inspector on every single C# file and I want to keep using it.

    Keep up the good work!! Thanks!
     
  5. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I don't have a specific ETA, because it's one major headache.

    If it's a trouble for you, the only "good" workaround I have right now is to offer you the source code so you can use AI without a .DLL.
     
  6. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    18
    I know, it must be :(


    That would be lovely, because it is the only asset I use i cannot work my way around to use the new features!

    PM me and we'll talk ;)

    Thanks A LOT!!
     
  7. Janoschii

    Janoschii

    Joined:
    Oct 15, 2014
    Posts:
    9
    What is the last version of Unity you would recommend with AI.

    PS: I really like your Asset and I use it with every component I write. Thanks a lot!
     
  8. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    5.2, 5.3, 5.4, 5.5, 5.6 works great and are fully stable. (On our game, we are currently using 5.5.3, but will go to 2017.2 in a couple of months)
    2017.1 and 2017.2 too, but may require turning off some component editors in the preference to access advanced renderer settings.
    2017.3 is fine, as long as you don't turn on .NET 4, but there isn't a direct version made to support it specifically.

    I would stay off 2017.3 for now. Everything else should be fine.
     
  9. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    "You may not start a conversation with the following recipients: FibriZzo."

    Well, I think the forum doesn't like me, or doesn't like you. You can come chat with me on discord; https://discord.gg/kXkB835
     
  10. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    You might be wondering what is happening with Advanced Inspector, and some major changes are coming.

    Moving to Version 2.00
    This is in part to separate the older structure from the new one. My plan is to submit this major iteration to the AssetStore today.

    Dropping Unity 5 Support
    Right now, the current version (1.72) on the Asset Store supports all Unity 5 version and is very stable. However, as Unity is moving to 2018, there isn't any need for me to backtrack to Unity 5, as most new features need 2017+ anyway. I'll still debug and support older version, but unless major bugs are found, no new version for Unity 5 will be released.

    Full 2017 Support
    Because of the next issue, I didn't spend enough time on upgrading the editors to support Unity 2017 specific features. This was especially true on the Camera, Light and Renderers with the new settings related to the new lightmapping.

    Dropping DLLs
    This is the big one that pushed back all the new release. In Unity 2017.2 and 2017.3, a number of changes was introduced to how Unity handles DLLs, which broke AI's one in spectacular ways. I've been searching for a solution since then, but haven't found one that would allow me to keep the current structure. Between the UnityEngine.DLL split into CoreModule and a number of small DLL, the .NET 4.6 support - which made Unity crash big time, the only solution was to dump the DLL. To explain in short, the AI's DLL had references to UnityEngine, UnityEditor, FirstPass, and FirstPassEditor, which appears to no longer be possible.

    On the upside, all AI's bitmap will be part of the assets, so they could be modified to your liking.

    On the downside, I expect this move to bring potential bugs... like any big change.
     
  11. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    18
    JUST. LOVE. IT!

    Keep up the good work!!
     
  12. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    2.00 is now available on the Asset Store!
     
  13. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Someone reported that if you're using the Asset Store Beta on Unity 2017 or 2018, it may download the wrong version of Advanced Inspector. It appears to be a behavior that does not occur on the normal Asset Store.

    If you are on 2017/2018, you have updated at the preference doesn't read 2.00, or you still have an "AdvancedInspector.dll" file, you don't have the latest version.
     
  14. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    Can this asset produce "linked pairs" in the inspector?

    My use case is that I want a designer to be able to drag any number of gameobjects to a list, and then add a corresponding gameobject for each entry, so each "pair" is easily accessible for me in the code as well.
     
    Last edited: Mar 19, 2018
  15. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Sounds like you're describing a Dictionary.
    If so, yes AI does support displaying and editing dictionaries. It also has a class named UDictionary, which is a Unity friendly serializable dictionary.
     
  16. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    Thank you for the quick reply! Do you have a link to any documentation of this feature in your asset?

    Does it display two columns side by side? I haven't seen a screenshot of that, but that would be ideal.

    EDIT: Thanks, but I ended up using this asset for now, but I'll keep yours in mind because what I actually would like to end up doing in the future is to have the ability to drop a GameObject into a field, and get a drop-down list of all AnimationClips in the Animator on that GameObject pop up in a column next to it!
     
    Last edited: Mar 19, 2018
  17. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Sure: http://lightstrikersoftware.com/docs/AdvancedInspector_Manual.pdf

    UDictionary is at page 31.
     
    ekergraphics likes this.
  18. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Version 2.00a submitted to the Asset Store. Quick fixes to Unity 2017.2 specific features.
     
    twobob and NeatWolf like this.
  19. gpvd

    gpvd

    Joined:
    Nov 2, 2013
    Posts:
    78
    Hello,

    I have a question (new feature request?)


    I'd like to be able to use icons in front of the groupname.
    The icons represent the state of fields in the group.

    For example; If one field has an invalid value, the whole group gets a red background + a red cross.
    This way, i can quickly see where i need to adjust some fields.
    See the image for an example.

    Is it somehow possible to do this dynamicly with the style property of a group or some other way?
    Right now i implemented this somewhat cumbersome and it would be great if i could do this with an advanced inspector function.

    Best regards,

    G
     

    Attached Files:

  20. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    I can't seem to figure out how this works. Could you give an example? What I'm hoping to achieve is to have an attribute use a function from a static utility class so I don't have to implement it everywhere. Like this:
    Code (CSharp):
    1. [Restrict("Utilities.GetValidNames", RestrictDisplay.Toolbox)]
    2. public string name;
    But when I do this, I receive the following error:
    Code (CSharp):
    1. ArgumentException: method argument length mismatch
    2. System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:226)
     
  21. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Is it possible to see the "Utilities.GetValidNames" method? The exception thrown says the method you're trying to use doesn't have the right parameters. The static and non-static delegate doesn't have the same signature.
     
  22. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Sorry for not answering before, didn't notice the message.

    Right now, it's not directly possible, as that space is held reserved for the different button; create, expand, etc.
    However, you could put those icon on the right of the separator.
     
  23. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    I wrote the function as if it was in the same class. How can I find out what the signature should be? This feature is not further explained in the manual. I also couldn't find an example in the example files. But I also don't know what I should search for.
    I'm not at my computer right now, but the function takes no parameters and returns IList<string>.
     
  24. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    If you look at the Attribute, you have 2 delegates declared at the top, which is the signature for a member method, and the other is for static;

    Code (CSharp):
    1. public delegate IList RestrictDelegate();
    2. public delegate IList RestrictStaticDelegate(RestrictAttribute restrict, object instance, object value);
    In the static version, the Attribute is passed along the object, and the value of the field the attribute is placed on.
     
  25. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    Ah I see! Thanks, this helped!
     
  26. gpvd

    gpvd

    Joined:
    Nov 2, 2013
    Posts:
    78
    Ok, i'll try that.
     
  27. zkkzkk32312

    zkkzkk32312

    Joined:
    Nov 4, 2016
    Posts:
    5
    Where can i download the latest version for Unity 5.x?
    aka the v1.72?

    the asset store only shows v2.0 for me.
     
    twobob likes this.
  28. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    If you're using the Asset Store using Unity 5.x, it should automatically download the proper version. (1.72a)
    In your download tab, it shouldn't show a version number if it's not supported.
     
  29. zkkzkk32312

    zkkzkk32312

    Joined:
    Nov 4, 2016
    Posts:
    5
    Can Confirm,
    the downloaded package is indeed 1.72 even if asset store said its 2.0.
     
    twobob likes this.
  30. kheldorin

    kheldorin

    Joined:
    May 28, 2015
    Posts:
    22
    Hi, is it possible to recreate a matrix the same way as the layer collision matrix in the physics manager?
     
  31. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I don't see why not. Any example of what the kind of data you would need in it?
     
  32. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    18
    Hello there! I have one simple question:

    I use advanced inspector's CreateDerived(true) attribute to populate a polymorphic list. For those who don't know that AI does with it, it is very simple:

    If you have an abstract class, por example, "Animal", and then you subclass it with "Dog", "Cat", or "Tiger", and you have a list of "Animals", you can use AI to let you choose which "Animal" to add every time you press "+", so it helps A LOT when using polymorphy because Unity, as far as I know, doesn't let you.

    You just have to inherit from "ComponentMonoBehaviour" in the main abstract class, and add the attribute [CreateDerived(true)] in the list variable. And voilá: whenever you press "+" you can select a Dog, Cat or Tiger.

    My question is simple: is there any way you can use this inside an Scriptable Object?

    If I follow the same steps and try to add a list of polymorphic elements in a scriptable object, it lets me choose whenever I press "+", but then the list stays with 0 elements.

    Is there a way to do this?

    Thanks a lot!
     
  33. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Yes, but instead of deriving from ComponentMonoBehaviour, you have to derive from ScriptableComponent.
     
  34. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    18
    And... just like that... a dozen "workarounds" I had to use by creating prefabs for these ComponentMonoBehaviours are gone, and everything is PERFECT inside ScriptableObjects!

    THANKS A F**** LOT!!!!!
     
  35. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Glad to help. :p
     
  36. CinnoMan

    CinnoMan

    Joined:
    Jan 27, 2014
    Posts:
    16
    Gradients: Changes made in Inspector in Editor Mode Don't Carry Over into Play Mode

    I've run into an issue where if I edit a Gradient in the inspector, when I go into Play Mode, one of two things happens:

    a) if it's a Gradient I defined a long time ago (possibly before installing Advanced Inspector, it resets to the previously defined values, resetting any changes made in the inspector.

    b) if it's a Gradient added to the script after installing Advanced Inspector, it just resets to Unity's default values for Gradients.

    Unity 2017.4.3f1, Advanced Inspector 2 (according to ReadMe)

    What am I missing? Any help would be greatly appreciated, I'm sure it's something basic.

    UPDATE: I tested it and it's definitely AI-related: changes I make to the Gradients in the inspector while "Inspect Default Items" is disabled behave normally, they carry over between Edit and Play mode. As soon as the respective class is inspected by AI the changes don't carry over anymore.

    The class may have a custom editor (it's a child class of a class from another plugin) which may be part of the issue here.
     
    Last edited: Sep 28, 2018
  37. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Hi,

    It would be a lot easier to help you with some example to work with. ;)
     
  38. CinnoMan

    CinnoMan

    Joined:
    Jan 27, 2014
    Posts:
    16
    Well, it's as simple as going:
    Code (CSharp):
    1. public Gradient   myGradient;
    then altering the gradient in the inspector and hitting the play button.
    But I haven't quite figured out yet what other custom inspector script might be interfering...

    I guess I'll email you with more details, don't want to clog this with weirdly specific bug reports. Was just hoping there might be some easy answer I might have missed.

    In the meantime, is it possible to exclude specific scripts from AI inspection? Don't want to have to manually include all the other scripts just for the sake of excluding a handful of affected ones...
     
  39. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Sure, an easy way to exclude it from AI is to simply make an empty Editor that handles your class.
    AI will see the custom editor and avoid it.
     
  40. CinnoMan

    CinnoMan

    Joined:
    Jan 27, 2014
    Posts:
    16
    Ok, thanks, I'll try that.
     
  41. PedroGV

    PedroGV

    Joined:
    Nov 1, 2010
    Posts:
    415
    Hi, I'm experiencing the following exception with the latest version of AI and Unity 2017.1.5:

    Code (CSharp):
    1. ail to find method or property named IsEditorPlaying
    2. UnityEngine.Debug:LogError(Object)
    3. AdvancedInspector.AdvancedInspectorControl:ParseRuntimeAttributes(IRuntimeAttribute, Type, Object[]) (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/AdvancedInspectorControl.cs:3493)
    4. AdvancedInspector.InspectorField:ParseMemberAttributes() (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/InspectorField.cs:1837)
    5. AdvancedInspector.InspectorField:.ctor(InspectorField, Object[], Object[], MethodInfo, Attribute[]) (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/InspectorField.cs:1627)
    6. AdvancedInspector.InspectorField:.ctor(InspectorField, Object[], Object[], MethodInfo) (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/InspectorField.cs:1616)
    7. AdvancedInspector.InspectorField:GetEntries(InspectorField, Object[], Boolean, Boolean) (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/InspectorField.cs:3540)
    8. AdvancedInspector.InspectorField:GetEntries(InspectorField, Object[], Boolean) (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/InspectorField.cs:3381)
    9. AdvancedInspector.InspectorEditor:RefreshFields() (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/InspectorEditor.cs:576)
    10. AdvancedInspector.InspectorEditor:set_Instances(Object[]) (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/InspectorEditor.cs:131)
    11. AdvancedInspector.InspectorEditor:OnEnable() (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/InspectorEditor.cs:218)
    12. AdvancedInspector.BehaviourEditor:OnEnable() (at Assets/Plugins/Editor/AdvancedInspector/AdvancedInspector/InspectorEditors/BehaviourEditor.cs:57)
     
  42. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Do you have something like "Inspect("IsEditorPlaying")" somewhere?
     
  43. PedroGV

    PedroGV

    Joined:
    Nov 1, 2010
    Posts:
    415
    Yes, I do: [ReadOnly("IsEditorPlaying", false)]

    Found it! IsEditorPlaying was declared inside #if UNITY_EDITOR block, and the calling method was not. Thanks!
     
    Last edited: Oct 8, 2018
  44. Ziflin

    Ziflin

    Joined:
    Mar 12, 2013
    Posts:
    132
    @LightStriker - Curious about support for 2018.3? AI has a lot of great features that I'd love to use. I'm still not sure how you got ComponentMonoBehavior and ScriptableComponent to work. There's a Unity feature request for that that's 6 years old with nearly 3000 votes...
     
  45. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Can I have a version of 1.72 cos I use unity 5?

    "Current version on the Asset Store; 1.72a (Supports Unity 5.2, 5.3, 5.4, 5.5, 5.6 and 2017.1)"

    No, it isn't.
    upload_2018-11-2_17-50-35.png
    And TBH the supported unity version seems to be only 2017.2 atm?

    How do I get the older version mate?
     
  46. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    If you download AI from Unity 5, the store is supposed to download 1.72.
    If you use 2017+, the store is supposed to download 2.00+
     
  47. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Magic! :)

    And I know it's a feature request Unity had for... A long time. I simply can't work without proper polymorphism. Especially that there isn't any excuse to not have it.

    Current version (2.00) should work on 2018, but I'm still looking into their new UI Element which will most likely be a massive pain to convert to.
     
  48. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I think it was that stupid "Unity Only Downloads if IF YOU DONT ALREADY HAVE THE WRONG VERSION STORED" thing again. (Otherwise you must go delete the wrong version and get the lesser one manually)


    Aight. not your issue, thanks
     
    Last edited: Nov 3, 2018
  49. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Okay so I deleted and downloaded "the right one" manually
    If I try to adjust any of my lights to REALTIME this happens.
    upload_2018-11-4_0-12-12.png

    Any clues?

    The README revision list only goes up to 1.7.2 but it would have been nice to have a version number at the top... to be certain

    The manual says 1.7.2 so... I reckon.
     
  50. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Do be certain, you open the Preferences, and go to the AI tab. The About shows the version currently running.
    Which version of Unity are you using on this screenshot?