Search Unity

Advanced Inspector - Never Write An Editor Again

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

  1. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    5.6.6,
    Seems legit
     
  2. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    says 1.71 beta?
    upload_2018-11-7_15-26-23.png

    upload_2018-11-7_15-29-39.png

    Don't know how else to try and get the right one?
     
  3. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I have honestly no idea why you would have 1.71 Beta. Clearly not supposed to be a valid version.
    The latest version on the store for Unity 5 is supposed to read 1.72a or 1.73.

    I just dusted off Unity 5, downloaded AI from the store and it imported me the 2017 version.
    Clearly the store needs to be a bit more careful on what it imports.

    If you send me an email to admin@lightstrikersoftware.com, I can send you the latest Unity 5 version.
     
    twobob likes this.
  4. rosevelt

    rosevelt

    Joined:
    Oct 23, 2012
    Posts:
    47
    Is Advance Inspector working well with Unity 2018.3 ?
     
  5. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    2018.2 yes...
    As for 2018.3, there's a lot of work underway to make it work with it.
     
  6. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    133
    Hey @LightStriker, great asset! Thanks very much for your hard work on it - it's saving me a lot of time and hassle. A quick request: the little in-scene asset picker which appears next to GameObject/component references is very cool. However, it doesn't respect the SelectionBase attribute. I have a hierarchy which looks like this:

    Code (CSharp):
    1. -[SelectionBase] ParentComponent
    2.   -SomeMesh
    3.   -SomeOtherMesh
    ...and I want to pick references to ParentComponent using the awesome little picker tool. However, it doesn't appear to work (no references are picked), presumably because it's only looking at the SomeMesh GameObjects and not walking up the hierarchy to find ParentComponent. To be clear: the ParentComponent doesn't have any Meshes or Colliders or anything which might be hit by a raycast (is that how it works?).

    Do you think it would be possible to add support for SelectionBase parent objects to the picker? It would be amazing if it were possible to do this.

    Thanks again!

    Ben
     
  7. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Shouldn't be very hard. In the ObjectField.cs file, you have a Pick() method where you could check for other component or attribute. I'm not too sure of the usual rules with SelectionBase, as last time I tried to use it it was a bit all over the place - even in normal Unity.
     
  8. Wriggler

    Wriggler

    Joined:
    Jun 7, 2013
    Posts:
    133
    Hey, thanks for the feedback. I've just got this implemented - I wasn't able to find Pick() as you stated, but I edited InspectorEditor.cs around line 347 to add an additional check for SelectionBase attributes up the chain. I used the Unity functions HandleUtility.FindSelectionBase() and HandleUtility.GameObjectContainsAttribute which someone has handily decompiled on Github.

    The picker is super usable now. Thanks for your help!

    Ben
     
  9. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    225
    I'm writing an editor again.
     
  10. SFvdB

    SFvdB

    Joined:
    Mar 10, 2014
    Posts:
    28
    Hi LightStriker! I love Advanced Inspector, works great! However I am a bit befuddled by the whole discussion with Miguel-Ferreira earlier in this thread, about adding a button to the inspector. A button below the properties that will allow one to perform an action in the editor, without having to write a custom editor.

    At the moment, my WorldCore class (which generates worlds) requires two simple buttons, so I wrote a custom editor for it - however this disables the use of Advanced Inspector. You mentioned using #if UNITY_EDITOR will allow one to put it in the class itself - without having to write a custom editor? However I haven't found an example of the correct syntax within this #if #endif statement, as the custom editor code only throws up errors.

    Could you elaborate with an example, perhaps?

    Edit: Example code that doesn't throw up errors and doesn't work. What am I missing?
    Code (CSharp):
    1.     #if UNITY_EDITOR
    2.  
    3.     public void OnInspectorGUI()
    4.     {
    5.        
    6.         if(GUILayout.Button("Generate World"))
    7.         {
    8.             GenerateWorld();
    9.         }
    10.        
    11.         if(GUILayout.Button("Delete World"))
    12.         {
    13.             DeleteWorld();
    14.         }
    15.     }
    16.    
    17.     #endif
     
  11. SFvdB

    SFvdB

    Joined:
    Mar 10, 2014
    Posts:
    28
    As is so often the case, I figured it out and it was MUCH MUCH simpler than I anticapated XD

    Just add the [Inspect] attribute to the desired method. Problem solved, it shows up in the inspector.

    Thanks! :D
     
  12. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Haha! I was writing you an answer. Yeah, I tend to like when it's simple.
     
  13. SFvdB

    SFvdB

    Joined:
    Mar 10, 2014
    Posts:
    28
    Hello again :D

    I have a different question. I am using a ScriptableObject called Map, which creates Tiles (also ScriptableObjects). These are stored in an Advanced Inspector UDictionary along with a Vector2. However when I enter or exit play mode, these get deserialized.

    Before:
    Screenshot 2019-03-09 at 17.05.36.png

    After:
    Screenshot 2019-03-09 at 17.05.45.png

    Now in the Map SO I have this creating the dictionary:

    [Serializable]
    public class GridDictionary : UDictionary<Vector2, Tile> { }
    public GridDictionary grid = new GridDictionary();


    Is it a bug? Did I write something wrong? Is it not supported this way? Am I missing a declaration or an attribute? Or is it because I am on 2018.3?

    Thanks!
     
  14. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Where are those Tile stored? A ScriptableObject is a file. Do you have a file for each of those tiles?
     
    SFvdB likes this.
  15. SFvdB

    SFvdB

    Joined:
    Mar 10, 2014
    Posts:
    28
    Again, answering my own question. ScriptableObjects in memory are not serialized, according to what I could fine. Not even when they're stored in a SO, apparently. Alright, taking a different approach. Still loving Advanced Inspector, by the way ;)
     
  16. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    Is there a reason for Tile to be a ScriptableObject?
     
  17. SFvdB

    SFvdB

    Joined:
    Mar 10, 2014
    Posts:
    28
    It's not related to Unity's 2D tilemaps. It would've made storing mapdata a bit easier. But I've decided to break it down a bit go for a simpler approach. That way it won't create a whole slew of asset files.
     
  18. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    I meant, is there a reason for it to be a ScriptableObject, instead of a normal object?
     
  19. noania

    noania

    Joined:
    Apr 19, 2014
    Posts:
    33
    Will the asset be updated for Unity2019? It has served me well for long time so I'm not complaining even if it won't be. I just would like to know whether if it's time for me to leave it behind and move on.
     
    NeatWolf likes this.
  20. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,717
    My goal is to rewrite it to use UIElements, which should give it quite a major performance boost. But sadly, I have no timetable on when that could be done.
     
    noania and NeatWolf like this.
  21. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    225
    I really wish Unity makes Advanced Inspector the official package. It's still the best inspector on the asset store. Here's a little fix for GradientEditor class.

    Code (csharp):
    1.  
    2.         public override void Draw(InspectorField field, GUIStyle style) {
    3.             object o = GetValue(field);
    4.  
    5.             var gradient = (Gradient)o;
    6.  
    7.             EditorGUI.BeginChangeCheck();
    8.             gradient = EditorGUILayout.GradientField(gradient);
    9.  
    10.             if (EditorGUI.EndChangeCheck()) {
    11.                 field.SetValue(gradient);
    12.             }
    13.         }
    14.  
     
  22. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    225
    So I'm still using this. Tried odin but it dropped my productivity. Advanced Inspector is still working on the latest unity(2019.3.3) though I might have modified the scripts here and there. It's a good thing the source code is available. I think I'll just keep fixing and using this. Really hoping there will be AdvancedInspector2. I will be glad to buy it.
     
  23. AGregori

    AGregori

    Joined:
    Dec 11, 2014
    Posts:
    527
    @noanoa I never got into the "Odin revolution" myself. If you make your Advanced Inspector tweaks public, I'd like to see and employ them, thanks.
     
  24. FibriZzo

    FibriZzo

    Joined:
    Feb 2, 2014
    Posts:
    18
    Yes! I am still using Advanced Inspector in my live projects... It still works, but I think a new version should be updated to cover some bugs, such as the one @noanoa is doing ;)

    Please make an official updated version of AI!
     
  25. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    225
    Sorry, I can't upload anything without author's permission. Besides, I don't remember which scripts/lines I've modified.and there aren't much to fix in the first place. I'll try to post a fix here if future unity update breaks the asset though.
     
  26. Orion

    Orion

    Joined:
    Mar 31, 2008
    Posts:
    261
    I'm also hoping for a "simple" update that takes care of the things that don't work optimally anymore since Unity 2020. Would be very appreciated.