Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Advanced Inspector - Never Write An Editor Again

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

  1. Astro75

    Astro75

    Joined:
    Dec 18, 2014
    Posts:
    45
    Unity does not serialize nested arrays. (Advanced Inspector could give some warning about that when we try to use it).
    Under the hood AI uses 2 lists for keys and values that are then serialized by unity.
    This should work.
    Code (CSharp):
    1.  
    2. [Serializable] public class SpriteArray {
    3.         public Sprite[] array;
    4. }
    5. UDictionary<string, TestArray>
     
    noanoa likes this.
  2. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Astro75 is right. Thanks for beating me to it. ;)
     
  3. noanoa

    noanoa

    Joined:
    Apr 17, 2014
    Posts:
    225
    Thanks for the answer, yes it works:)
     
  4. nlebedenco

    nlebedenco

    Joined:
    May 12, 2014
    Posts:
    10
    @LightStriker Hi, just got Adv.Insp. and I must say it's an awesome package! Just wanted to add that after playing with it a bit I found the default order of elements in the inspector to be a bit counter-intuitive so I'd suggest to mention it in the Manual (or have I missed it?) Take this simple script for instance:

    Code (CSharp):
    1. using System;
    2. using UnityEngine;
    3. using AdvancedInspector;
    4.  
    5. [Serializable]
    6. public class Bla
    7. {
    8.     [Inspect]
    9.     public int A;
    10.     [SerializeField]
    11.     [Inspect]
    12.     private int B;
    13.  
    14.     [Inspect]
    15.     public int C { get; set; }
    16.  
    17.     [Inspect]
    18.     private int D { get; set; }
    19.  
    20.     [Inspect]
    21.     private int E;
    22.  
    23.     [Inspect]
    24.     public void M1() { }
    25.  
    26.     [Inspect]
    27.     private void M2() { }
    28. }
    29.  
    30. public class foo : MonoBehaviour
    31. {
    32.     public Bla bla = new Bla();
    33. }
    Without specifying a priority parameter I naively expected the order of displayed items to be A, B, C, D, E, M1, M2.
    but the actual display order is M1, M2, C, D, A, B, E
    It makes sense cause you're prob. first searching for attributes on methods followed by properties then fields, which I totally understand, but again I had to stop and think about it for a second before accepting it.

    EDIT: Just realized the Watch window is broken with this same script if you try to watch more than one field.
     
    Last edited: Mar 9, 2017
  5. Pixeye

    Pixeye

    Joined:
    Jul 2, 2011
    Posts:
    193
    Hi LightStriker! I'm using your Advanced inspector and loving it : ) Though I've implemented my own "sub component" system based on ScriptableObject Instances I find my solution pretty "ugly" but straightforward. I noticed that your package included componentMonoBehaviour and as far as I see it works awesome and in far more elegant way. The question may be silly : is your sub component system is OK for using on different platforms? Like ios, android or consoles? I mean - won't there be any glitches or bugs when I complile the game. Also I don't derive my logics from monobehaviour directly , I use my implementation of "cashedmonobehaviour ( that derives from monobehaviour ) with some custom settings that fits my architecture needs. Will it be ok to clone ComponentMonoBehaviour and derive it from my cashedmonobehaviour ( it uses Awake, OnDestroy, OnApplicationQuit methods and cashe some common object data ) ?
     
  6. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    The issue is simply; there is no way in code to figure out in which order different elements were written in a class. Usually the C# compiler lists fields in order - but even then it's not garantied. When there's fields, properties and methods all mixed with each other, order can't be found.

    You can sort inspected element by names by right-clicking on a field in the inspector and changing the display order. Otherwise, you will need to add priorities in the elements.

    Thanks, I'll check the watch window.
     
  7. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Under the hood, the ComponentMonoBehaviour are... MonoBehaviour that Advanced Inspector displays and allow you to create differently. So yes, they work find on all platform Unity supports.

    I wouldn't advise to clone ComponentMonoBehaviour. You could derive your CashedMonoBehaviour from it. That's usually the proper way to do it.
     
  8. Miguel-Ferreira

    Miguel-Ferreira

    Joined:
    May 8, 2015
    Posts:
    90
    Hi,

    I have a general question about AdvancedInspector. Is there any technical reason for the AI attributes not being in their own separate .DLL? I want to generate a DLL of my own that uses AI's attributes, but in order to do that, I need to add a dependency from a dummy Assembly-CSharp-firstpass.DLL, which, is not only weird, but causes Unity to crash when I do a full reimport of my project with my DLL on it.
     
  9. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    The attributes/FieldEditor/Base types are all outside a DLL so people could modify them or create new ones to suit their needs.

    I have no idea why would Unity crash while doing a reimport.
     
  10. apiotuch

    apiotuch

    Joined:
    Oct 8, 2009
    Posts:
    42
    Hello, my project has Advanced Inspector and we are deploying a VR native version Unity 5.5. However, having VR native enabled does not compile the plugins folder for first pass as mentioned in Unity docs (https://docs.unity3d.com/Manual/VROverview.html). I noticed in the Advanced Inspector docs that Advanced Inspector had scripts moved to plugins to provide JS script support. However, when I move the scripts out of the plugins folder, I get numerous errors. Is there any plan to update a package for native VR support? I had to move other scripts out of plugins that are required for the project and they use advanced inspector so I am hoping there is a solution at the very least planned. Any help would be great. Excellent Asset, would be a shame if we couldn't use it anymore. We do not use JS in this particular project so I do not need Advanced inspector in the plugins folder. These errors only appear when I try to enter play mode. upload_2017-3-22_16-9-54.png
     
  11. lulitd

    lulitd

    Joined:
    Feb 20, 2016
    Posts:
    13
    I just purchased Advance Inspector and so far I'm loving it.

    Currently, I have two questions in relation to UDictionary with a nested list of game objects as its values and an enum as its keys.

    1. When I try to populate the list of game objects via the inspector, the word 'script' gets appended to each entry [see attached image for reference]. Not entirely sure what is causing that, as it doesn't appear in just a regular collection.

    2. This is just a cosmetic issue but is there way to hide the fact that for this dictionary I've nested in a list.
    Particularly hiding the 'Objects' Label[See attached image]?

    Capture_.PNG

    Code (CSharp):
    1.  
    2. [System.Serializable]
    3.     public class GameMode : UDictionary<GameModeType,ObjectsInMode> {
    4.     }
    5.  
    6.     [System.Serializable,Expandable(Expanded = false)]
    7.     public class ObjectsInMode
    8.     {
    9.         [Expandable(AlwaysExpanded = true),Help("GetHelp")]
    10.         public List<GameObject> Objects;
    11.  
    12.         private HelpItem GetHelp()
    13.         {
    14.             if (Objects.Count == 0)
    15.                 return new HelpItem(HelpType.Warning, "Add objects here.");
    16.             else return null;
    17.        
    18.         }
    19.     }
    20.  
    21. [HideInInspector]
    22. public enum GameModeType
    23. {
    24.     ENVIRONMENT_MOTION,
    25.     INTERACT_OBJECTS,
    26.     BODY_MOTION
    27. }
     
  12. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    I'll have to dig deeper. I have absolutely no clue why Unity would disable plugin for VR.

    An alternative would be for your to contact me, and I could supply you the source of AI's dll so it could compile with the rest of your project. However, that code is undocumented.
     
  13. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    1. This obviously a bug and it shouldn't happen. I'll look into it.

    2. Sadly no... There's no easy way to hide that.
     
  14. apiotuch

    apiotuch

    Joined:
    Oct 8, 2009
    Posts:
    42
    My understanding is for VR performance reasons. Rendering at 90 fps plus motion tracking, every additional pass adds time to a frame, which creates nausea for the user. Native support is not required to run VR, but it improved performance by implementing lower level code for VR.

    How can I get in contact with you?
     
  15. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    admin@lightstrikersoftware.com
     
  16. frosted

    frosted

    Joined:
    Jan 17, 2014
    Posts:
    3,822
    So Advanced Inspector has a breaking bug with prefabs when they reference a child node.

    Animated Gif showing problem:
    bug_report.gif

    It's a pretty major issue since the logic for prefab references is super wrong, whats worse is that it may corrupt existing prefabs.

    Step 1: Make game object ("A")
    Step 2: Add monobehaviour with a field that is a reference.
    Step 3: Add a child game object ("B"). Set the field in "A" -> "B"
    Step 4: Save as prefab

    Advanced Inspector's display is now incorrect (shows a modification in the prefab immediately after creating it).

    Right click "Apply to Prefab" will now write bad data to the prefab, corrupting it (it will try to write the scene instance of B to the prefab - which is not allowed and incorrect).

    This asset is so unbelievably promising in most ways, having it be unusable because it doesn't properly handle prefabs would really be a shame. Hopefully there will be a fix to correct the issues with references soon.
     
  17. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Thanks. I'm looking into it... but it does look rather deep. I hope to have something by the weekend.
     
  18. mcurtiss

    mcurtiss

    Joined:
    Nov 29, 2012
    Posts:
    26
    I may be getting ahead of things, but I've recently updated Unity to version 5.6, and am getting these errors (this is in an empty project):

    ArgumentNullException: Argument cannot be null.
    Parameter name: type
    System.Activator.CheckType (System.Type type) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:378)
    System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:280)
    System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:268)
    System.Activator.CreateInstance (System.Type type, System.Object[] args) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:263)
    AdvancedInspector.AnimationEditor.OnEnable () (at Assets/Plugins/Editor/AdvancedInspector/UnityTypes/AnimationEditor.cs:27)
    UnityEngine.ScriptableObject:CreateInstance(Type)
    AdvancedInspector.InspectorEditor:Gather() (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/InspectorEditor.cs:593)
    AdvancedInspector.InspectorEditor:OnEnable() (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/InspectorEditor.cs:185)

    and...

    ArgumentNullException: Argument cannot be null.
    Parameter name: type
    System.Activator.CheckType (System.Type type) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:378)
    System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:280)
    System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:268)
    System.Activator.CreateInstance (System.Type type, System.Object[] args) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Activator.cs:263)
    AdvancedInspector.BoxColliderEditor.OnEnable () (at Assets/Plugins/Editor/AdvancedInspector/UnityTypes/BoxColliderEditor.cs:24)
    UnityEngine.ScriptableObject:CreateInstance(Type)
    AdvancedInspector.InspectorEditor:Gather() (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/InspectorEditor.cs:593)
    AdvancedInspector.InspectorEditor:OnEnable() (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/InspectorEditor.cs:185)

    It compiles fine if I turn off the AnimationEditor and the BoxColliderEditor in the AdvancedInspector preferences.
     
    Owlglass_Moot and LunaTrap like this.
  19. LunaTrap

    LunaTrap

    Joined:
    Apr 10, 2015
    Posts:
    107

    I Ditto this

    @LightStriker
     
    Owlglass_Moot likes this.
  20. Owlglass_Moot

    Owlglass_Moot

    Joined:
    Jan 4, 2015
    Posts:
    9
    I'm getting these errors as well.
     
  21. AleksLA

    AleksLA

    Joined:
    May 7, 2013
    Posts:
    22
    I wasted at least 40 hours of my life because of this library. It is hiding the BlendShape property on
    SkinnedMeshRendererEditor , how on the earth nobody caught this obvious mistake !?!?!!?!? Do you have any idea how hard it is to find this mistake in this library on 200 gb project??!

    Also I still don't see any response or any update on my request for previews on the prefab.
    It would have been nice at least to say "I am not planning to implement this feature, but thanks for the effort of making screenshots and suggesting this idea", or any kind of response just so I know if I should wait for this feature or not.
     
  22. mcurtiss

    mcurtiss

    Joined:
    Nov 29, 2012
    Posts:
    26
    Something odd going on with UDictionary serialization/compilation that I am unsure of how to resolve.
    Basically, If I create a class that extends UDictionary<Component,float>, and create an instance of that class in a class that extends MonoBehaviour, then that UDictionary instance will lose its references every time the project recompiles. To be clear, the serialization works when pressing play - its just recompiling that breaks it.

    Here's a trivial example that runs into the problem:

    Code (CSharp):
    1. public interface MyInterface {
    2.     float Value {get;}
    3. }
    4.  
    5. public class TestImplementer : MonoBehaviour, MyInterface {
    6.     public float Value { get { return 1;}}
    7. }
    8.  
    9. [Serializable]
    10. public class WeightDictionary : UDictionary<Component,float> { }
    11.  
    12. public class TestDictionary : MonoBehaviour{
    13.  
    14.     // In the Unity Editor, assign some TestImplementers as keys of this Dictionary
    15.     [SerializeField] private WeightDictionary _weightDictionary;
    16.  
    17.     // Simple test to see if the dictionary is working properly
    18.     void Awake(){
    19.         Debug.Log(_weightDictionary.Count);
    20.  
    21.         float value = 0;
    22.         foreach (KeyValuePair<Component,float> entry in _weightDictionary){
    23.             MyInterface mi = (MyInterface)entry.Key;
    24.  
    25.             if (mi == null){
    26.                 Debug.LogError("member does not implement MyInterface");
    27.                 break;
    28.             }
    29.  
    30.             value += mi.Value * entry.Value;
    31.         }
    32.      
    33.         Debug.Log(value);
    34.     }
    35. }
    36.  
    37.  
     
  23. delphinius81

    delphinius81

    Joined:
    Mar 6, 2012
    Posts:
    56
    Also getting a bunch of errors with 5.6 as well. Seeing this one with regards to lights and the "Baking" drop down menu:

    Code (CSharp):
    1. InvalidCastException: Value is not a convertible object: System.Int32 to System.Enum
    2. System.Convert.ToType (System.Object value, System.Type conversionType, IFormatProvider provider, Boolean try_target_to_type) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Convert.cs:2941)
    3. System.Int32.System.IConvertible.ToType (System.Type targetType, IFormatProvider provider) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Int32.cs:763)
    4. System.Convert.ToType (System.Object value, System.Type conversionType, IFormatProvider provider, Boolean try_target_to_type) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Convert.cs:2937)
    5. System.Convert.ChangeType (System.Object value, System.Type conversionType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Convert.cs:2490)
    6. AdvancedInspector.InspectorField.SetValue (System.Object instance, System.Object value) (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/InspectorField.cs:2774)
    7. AdvancedInspector.InspectorField.SetValue (System.Object value) (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/InspectorField.cs:2745)
    8. AdvancedInspector.AdvancedInspectorControl.DrawRestricted (AdvancedInspector.InspectorEditor editor, AdvancedInspector.InspectorField field, IList`1 data, UnityEngine.GUIStyle style) (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/AdvancedInspectorControl.cs:1826)
    9. AdvancedInspector.AdvancedInspectorControl.DrawField (AdvancedInspector.InspectorEditor editor, AdvancedInspector.InspectorField field, UnityEditor.PropertyDrawer[] properyDrawers, System.Collections.Generic.Dictionary`2 fieldDrawers, AdvancedInspector.FieldEditor fieldEditor, UnityEngine.GUIStyle style) (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/AdvancedInspectorControl.cs:1281)
    10. AdvancedInspector.AdvancedInspectorControl.DrawNode (AdvancedInspector.InspectorEditor editor, AdvancedInspector.InspectorField field, Boolean refresh, Boolean expansion) (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/AdvancedInspectorControl.cs:1159)
    11. AdvancedInspector.AdvancedInspectorControl.Draw (AdvancedInspector.InspectorEditor editor, AdvancedInspector.InspectorField parent, System.Collections.Generic.List`1 fields, Boolean newGroup, Boolean refresh, Boolean expansion) (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/AdvancedInspectorControl.cs:799)
    12. AdvancedInspector.AdvancedInspectorControl.Inspect (AdvancedInspector.InspectorEditor editor, System.Collections.Generic.List`1 fields, Boolean newGroup, Boolean refresh, Boolean expansion, AdvancedInspector.Separator externalSeparator) (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/AdvancedInspectorControl.cs:702)
    13. AdvancedInspector.AdvancedInspectorControl.Inspect (AdvancedInspector.InspectorEditor editor, System.Collections.Generic.List`1 fields, Boolean newGroup, Boolean refresh) (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/AdvancedInspectorControl.cs:641)
    14. AdvancedInspector.InspectorEditor.DrawAdvancedInspector () (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/InspectorEditor.cs:496)
    15. AdvancedInspector.InspectorEditor.OnInspectorGUI () (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/InspectorEditor.cs:385)
    16. UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean rebuildOptimizedGUIBlock, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1229)
    17. UnityEditor.PopupCallbackInfo:SetEnumValueDelegate(Object, String[], Int32)
     
  24. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,977
    Hey, @LightStriker. Just bought AI today and am very impressed with it already. This despite the fact that I can't get any of the code to work!

    I'm having the "type or namespace ... could not be found" error that suggests the asset isn't visible to the project in MonoDevelop. I've tried all the usual tricks like deleting the .csproj and .sln files, syncing the project, etc. Still can't seem to get MonoDevelop to pick up the classes or attributes.

    What's weird is that the Unity IDE shows Inspector menus like it's supposed to, but the errors showing in MonoDevelop are shown in the console as well. So it doesn't seem to just be that MonoDevelop is out of sync or something...

    I'm on a Mac, so Visual Studio isn't an option for me, either. Any idea why this might be happening?

    Edit: This information may be useful.

    Unity Version 5.6.0f3
    Console after fresh import of Advanced Inspector:
    Edit 2: When I go to reimport the package, the files pictured here are indicated as missing or changed. I've already disabled the BoxCollider and Animation editors to work around that null error mentioned earlier.
    Screen Shot 2017-04-07 at 10.47.57 PM.png
     
    Last edited: Apr 8, 2017
  25. CyanSlinky

    CyanSlinky

    Joined:
    Feb 27, 2014
    Posts:
    17
    I recently bought this, and was wondering if you're working on updating it to 5.6 ? there's quite a few warnings and sometimes 2 ArgumentNullException errors like people mentioned earlier in this thread. Other than that this is a fantastic asset and I'm really glad i bought it.
     
    Last edited: Apr 12, 2017
  26. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,977
    @LightStriker has been providing regular updates so far, so I have no reason to believe he won't continue to do so. It can be very difficult to keep up with the breaking changes Unity introduces (especially when you're writing Editor integrations), and they seem to be releasing breaking updates with increasing frequency these days!

    In the meantime, if you go into Preferences -> Adv. Inspector -> Editors and turn off AnimationEditor.cs and BoxColliderEditor.cs, those ArgumentNullExceptions will go away and you can use Advanced Inspector normally.
     
  27. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Usually I get an email as soon as there's a reply on this thread.

    For some reason, I got none. My apologizes.

    I'm working on a 5.6 version. Kinda surprised how much stuff they changed from 5.5 to 5.6 (Like breaking the cloth component! Arg!)

    You can turn off the SkinnedMeshRendererEditor in the AI preference. I'll update it to display the BlendShapes. (Was sure I did, I guess I missed something)

    Preview on the prefab? Is it what I answered you that we don't have access to make custom preview because that is not exposed by Unity, or is it something else?
     
    Schneider21 likes this.
  28. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Which version of Unity are you on? I just tried it on and it works fine.
    However, if I remember well, the TestDictionary class needs to be defined first in a file of the same name.
     
  29. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Thanks. 5.6 version is on the way.
     
  30. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    A version is on the way to fix all those.
     
  31. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Yeah... My Cloth component isn't working anymore. :(
     
  32. Owlglass_Moot

    Owlglass_Moot

    Joined:
    Jan 4, 2015
    Posts:
    9
    Excited for the update! I've been holding off on using this because of the issue with prefabs.

    In one of the example classes (AIExample25_Style), there's a comment saying that a full list of EditorStyles can be found at http://kwnetzwelt.net/wordpress/archives/2200. The URL looks to be dead, though; do you happen to have a working link?
     
    Last edited: Apr 14, 2017
  33. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    I'm sorry, I don't have a working link. But this looks pretty badass; https://www.assetstore.unity3d.com/en/#!/content/3282

    And the prefab issue won't be in this version, because I rushed a version that fixed the warnings and errors on Unity 5.6. To be honest, Unity 5.6 is giving me a lot of trouble. They change so many things for no apparent reason! They namespaced stuff, renamed, change method definition, and even deleted entire classes! I'm not even sure why they did half of those changes. And they broke the cloth component good.

    On that, I just submitted a version with the following;

    1.72
    [FIXES]
    - Added support for Unity 5.6.
    - Fixed warnings and errors related to Unity 5.6 changes.
    - Added properties for motion vectors in the mesh renderer.
    - For now, it is advised to turn off the MeshRenderer editor if you want to use the new Lightmap settings. Proper support is coming soon.

    I've tested all the type that AI supports and it appears to work on 5.6. Let me know if you get any warning or error.

    I should have a lot more time next week after we sign a deal with a publisher... To add the new static lightmap option, the blendshapes, the prefab bug...

    Check our Kickstarter if you have 2 second? https://www.kickstarter.com/projects/hellpoint/hellpoint-a-dark-sci-fi-rpg
     
    Schneider21 and Owlglass_Moot like this.
  34. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,977
    Is the prefab bug related to what I emailed you about yesterday? If so, I'll stop harassing you and wait patiently for a resolution. :p

    Although my initial impression was that it's a generic sci-fi fantasy action game, the part about dying makes you respawn in a different, newly generated world is really cool! I'll be very interested to see how that works out! Looks like you guys are on target to surpass your goal! Good luck!
     
  35. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    No, it's not related.
     
  36. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,977
    Did you ever find a workaround for this? I think I'm running into the same issue. In my case, the UDictionary is in a prefab (used by @LightStriker's Universe plugin) and while I can edit and add content just fine, but if I enter Play mode or close Unity, the data isn't saved.

    Code (CSharp):
    1. public enum EvtCatType {
    2.     Player,
    3.     Random,
    4.     Character,
    5.     World
    6. }
    7.  
    8. [System.Serializable]
    9. public class EvtCatDictionary : UDictionary<EvtCatType, EvtCategory> {}
    10.  
    11. [System.Serializable, AdvancedInspector(true, false)]
    12. public class EvtCategory : ComponentMonoBehaviour {
    13.     [CreateDerived(true), SerializeField]
    14.     public Evt[] events;
    15. }
    16.  
    17. [System.Serializable, AdvancedInspector(true, false)]
    18. public class EventManager : Manager<EventManager> {
    19.     [CreateDerived(true), SerializeField]
    20.     public EvtCatDictionary eventCategories = new EvtCatDictionary();
    21. }
    @LightStriker's been trying to help me figure it out, but no solution as yet.

    Edit: Didn't see I had an email from the man himself before posting! It turns out, my issue is likely due to the fact that my classes EvtCategory and Evt are inheriting from ComponentMonoBehavior when they shouldn't be. I had a mistaken understanding of what that class was used for.
     
    Last edited: Apr 23, 2017
  37. Owlglass_Moot

    Owlglass_Moot

    Joined:
    Jan 4, 2015
    Posts:
    9
    Hello! Quick question: Is there a way to implement UDictionary so that the TValue isn't expandable?

    I'm working on a project that allows for extensive modding via JSON. Here's the base JSON class, the wrapper, and an example implementation:
    Code (CSharp):
    1. [Serializable]
    2. public abstract class Json
    3. { // Base of all JSON data
    4.    public int id;
    5. }
    6.  
    7. [Serializable]
    8. public class JWrapper<J> where J : Json
    9. { // Wrapper class that plays nicely with Unity's JsonUtility loader
    10.    public J[] database;
    11. }
    12.  
    13. [Serializable]
    14. public class JEnemy : Json
    15. { // Enemy JSON data
    16.    public string name;
    17.    public JEnemyColor color;
    18.  
    19.    public class JEnemyColor
    20.    {
    21.       public string group;
    22.       public string hexValue;
    23.    }
    24. }


    And here's an example of my UDictionary implementations. Double-implemented because I know Unity can't show generics:
    Code (CSharp):
    1. [Serializable]
    2. public class JDictionary<J> : UDictionary<int, J> where J : Json { }
    3.  
    4. [Serializable]
    5. public class JEnemyDictionary : JDictionary<JEnemy> { }


    And here's the JEnemyManager that I'm running into problems with, plus the generic method that adds stuff to the UDictionary:
    Code (CSharp):
    1. public class JEnemyManager : MonoBehaviour
    2. {
    3.    [Inspect] private List<JEnemy> jEnemyList;
    4.    [Inspect] private JEnemyDictionary jEnemyByID;
    5.  
    6.    private void Start()
    7.    {
    8.       jenemyList = new List<JEnemy>();
    9.       jEnemyByID = new JEnemyDictionary();
    10.       var loadedString = string.Empty;
    11.       // Do some stuff where I get a JSON file from the user's game folder (or a default
    12.       // TextAsset), and then unpack it to a string and assign it to loadedString.
    13.       MyJsonUtils.Load(ref jEnemyList, ref jEnemyByID, new JWrapper<JEnemy>(), loadedString);
    14.    }
    15. }
    16.  
    17. public static class MyJsonUtils
    18. {
    19.    public static void Load<J, D, W>(ref List<J> list, ref D dictionary, W wrapper, string jsonString)
    20.       where J : Json
    21.       where D : JDictionary<J>
    22.       where W : JWrapper<J>
    23.    {
    24.       var loadedArray = JsonUtility.FromJson<W>(jsonString).database;
    25.       foreach (var json in loadedArray) {
    26.          list.Add(json);
    27.          dictionary.Add(json.id, json);
    28.       }
    29.    }
    30. }


    JEnemyManager.jEnemyList looks and works great, but JEnemyManager.jEnemyByID shows nothing added to it. And when you navigate to a different GameObject and back to JEnemyManager, it vanishes and throws an "Array index is out of range" exception.

    I'm assuming it has to do with JEnemy being expandable by default. But if I add [DisplayAsParent(false)] or [Serializable, Expandable(false)] to the JEnemy class definition, then JEnemyManager.jEnemyList won't work as needed. Is it possible to make a class un-expandable only when it's used as the TValue of the UDictionary?

    Any words of advice would be greatly appreciated! :confused:

    P.S. Any luck solving the prefab bug?
    P.P.S. Congrats on reaching your KickStarter goal!
     
    Last edited: May 8, 2017
  38. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Cool. I love quick question...

    How do you plan to edit that class if you cannot inspect it? Why even display a dictionary if you're not serializing it?

    Thanks! We still have 25h to go on the Kickstarter.

    As for the prefab bug, while I can reproduce it, I haven't found a way to fix it properly without breaking inspection of properties on a prefab.
     
  39. Owlglass_Moot

    Owlglass_Moot

    Joined:
    Jan 4, 2015
    Posts:
    9
    My code doesn't really make use of jEnemyList for anything; I just included it as a "temporary view" of sorts if I wasn't able to get the dictionary to work in the inspector.

    It's not a big deal, really. I can just keep the list for quick viewing of the data and use the dictionary under the hood.

    Thanks!
     
  40. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    244
    Getting a lot of errors when having a certain component open. The errors are all in the line of

    "NullReferenceException: Object reference not set to an instance of an object
    AdvancedInspector.AdvancedInspectorControl.DrawDictionary (AdvancedInspector.InspectorEditor editor, AdvancedInspector.InspectorField field) (at A:/LightStrikerSoftware/Projet/AdvancedInspector/AdvancedInspector 5/Lib/AdvancedInspector/AdvancedInspector/AdvancedInspectorControl.cs:2169)"

    What's the reason for this, and how do I stop the errors?
     
  41. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Well, you're drawing a dictionary. Mind showing your code of that?
     
  42. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    244
    Actually I'm not drawing the dictionary. It's set to private. But still, here's the code:

    public Dictionary<string, List<VoxelTemplate>> voxelTemplatesByID { get; private set; }
     
  43. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    A collection inside a dictionary isn't supported.

    Try making a class that contains a collection instead.
     
  44. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    244
    The thing is that I'm not interested in displaying this property inside the inspector. It's set to be private anyway. Why I get errors puzzles me.
     
  45. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Are you sure it's set to private? You're last post said public:

    Code (CSharp):
    1. public Dictionary<string, List<VoxelTemplate>> voxelTemplatesByID { get; private set; }
    You could try adding [HideInInspector] on it.
     
    ratking likes this.
  46. tempbuffer

    tempbuffer

    Joined:
    Dec 6, 2012
    Posts:
    14
    Hello, I have two questions:
    1. Light component is not completely supported by AI 1.7.2. The problem is bake mode, it's changed from int to enum:
    "InvalidCastException: Value is not a convertible object: System.Int32 to System.Enum"

    2. How can I turn off AdvancecInspector for a specific monobehaviour?

    Thanks!
     
  47. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    1. I know. The new lighting is pretty complex. They added a lot of stuff.

    2. Easy, if you go in the preference you can disable a specific inspector in the Editors tab.
     
  48. XaneFeather

    XaneFeather

    Joined:
    Sep 4, 2013
    Posts:
    90
    Not sure if this has been reported before or not, but I just found out that if you set a Collection display mode to "DropDown", setting Size to zero does not remove the button for removing items.

     
  49. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,598
    Interesting. No, I wasn't aware of it.
     
  50. tempbuffer

    tempbuffer

    Joined:
    Dec 6, 2012
    Posts:
    14
    Thanks for reply. For question2, I didn't mean built-in editors but custom monohaviours, since Adv.Inspector seems affect every monobehaviours except custom Editor script.
     
unityunity