Search Unity

[Released] Serializable Dictionary Lite - Now allowing custom editor for key field

Discussion in 'Assets and Asset Store' started by Rotary-Heart, Feb 19, 2018.

  1. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
  2. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    71
    There is a problem with OpenUPM not recognizing a valid git tag for SDL.

    Edit: I think I found the issue. upm which uses npm underneath only recognizes SemVer syntax. That means 3 numbers in the version string only.
     
    Last edited: Oct 29, 2021
  3. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Good catch, I didn't realize that it had an issue. It has been fixed now.
     
  4. minad2017

    minad2017

    Joined:
    Dec 1, 2016
    Posts:
    50
    hi.
    I'm using the Lite version of Unity 2020.3.10f1.

    When I use the "StringColorArrayDictionary", the name is not visible to the inspector.
    It only becomes visible again when I hover the mouse pointer over it.
    I recently went from Unity 2019 to 2020, and I remember that it was not a problem in 2019.
    Is there any way to fix this?
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      19.5 KB
      Views:
      274
  5. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Can you send a small reproducible package? I'm having trouble replicating this
     
  6. tonygiang

    tonygiang

    Joined:
    Jun 13, 2017
    Posts:
    71
    Hey, just a heads up about the documentation of this package that you may want to consider updating: I think users should be aware that starting from Unity 2020, subclassing
    SerializableDictionaryBase
    to a non-generic class is now a completely optional step. Unity 2020+ can now serialize generic classes. So users of this package can now just do this:

    Code (CSharp):
    1. public SerializableDictionaryBase<string, UnityEvent<string>> StringEvents
    2.     = new SerializableDictionaryBase<string, UnityEvent<string>>();
    Yes, Unity 2020+ even handles nested generics. The above field looks like this in Inspector:

     
  7. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    While that is true, I've received a couple of support tickets while using a direct generic declaration. Here's a thread I made about it https://forum.unity.com/threads/generic-reference-is-ignoring-default-values-case-1376739.1189978/
     
  8. sunwooz

    sunwooz

    Joined:
    Nov 9, 2012
    Posts:
    10
    Is there a complete example using a simple Dictionary with key of string and value of class? I'm pretty new to Unity and I'm having a hard time getting the dictionary to show up in the editor.

    Code (CSharp):
    1.  
    2. using RotaryHeart.Lib.SerializableDictionary;
    3.  
    4. [Serializable]
    5. public class MyDictionary : SerializableDictionaryBase<string, List<ItemEffect>> { }
    6.  
    7. [SerializeField]
    8. public MyDictionary itemEffects;
    9.  
    10. public class ItemEffect
    11. {
    12.     [SerializeField]
    13.     public string resource { get; set; }
    14.     [SerializeField]
    15.     public int amount { get; set; }
    16. }
    17.  
    Should this be enough to get it to work?
    Maybe I need to instantiate the dictionary to get it to show?
    Any help would be appreciated
     
  9. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Hello,

    You are really close to having it good to go! You can check the advanced dictionary from the documentation if you want more information, but what you are missing is a wrapper class for your List<ItemEffect> value. Unity cannot serialize multi-dimension array. You also need to mark your class as Serializable and you may not be able to use properties as SerializeFields without an additional attribute (Depends on Unity version and a couple of other stuff).

    Check the code changes below, this should fix your issues.

    Code (CSharp):
    1. using RotaryHeart.Lib.SerializableDictionary;
    2.  
    3. [Serializable]
    4. public class MyDictionary : SerializableDictionaryBase<string, ValueWrapper> { }
    5.  
    6. [SerializeField]
    7. public MyDictionary itemEffects;
    8.  
    9. [Serializable]
    10. public class ItemEffect
    11. {
    12.     [SerializeField]
    13.     public string resource;
    14.     [SerializeField]
    15.     public int amount;
    16. }
    17.  
    18. [Serializable]
    19. public class ValueWrapper
    20. {
    21.     public List<ItemEffect> values;
    22. }
     
    andreiagmu likes this.
  10. sunwooz

    sunwooz

    Joined:
    Nov 9, 2012
    Posts:
    10
    Thank you for your quick reply!

    I see the Dictionary now in the editor, but can't seem to modify the values. Do I need to do something extra to be able to modify the values?

    upload_2022-6-7_17-45-17.png
     
  11. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Did you make all the changes provided above? You seem to be missing the Serializable attribute.
     
  12. sunwooz

    sunwooz

    Joined:
    Nov 9, 2012
    Posts:
    10
    You're right. I was missing the Serializable on the ItemEffect class

    Now I can add elements to the array, but I can't seem to add the resource/amount for each array element.

    upload_2022-6-7_18-35-44.png

    I tried adding SerializeField inside the value wrapper, but that didn't work.. hmm.

    Thanks for your patience!
     
  13. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Did you change your properties to be fields as posted on the code above? You might need to read this Serialization for more details about Unity limitations.
     
  14. sunwooz

    sunwooz

    Joined:
    Nov 9, 2012
    Posts:
    10
    Thank you for the link!

    I was able to get it to work by changing this in the ItemEffect class.

    Code (CSharp):
    1.  
    2. [Serializable]
    3.     public class ItemEffect
    4.     {
    5.         [SerializeField]
    6.         public string resource {
    7.             get => m_backing;
    8.             private set => m_backing = value;
    9.         }
    10.         [SerializeField] private string m_backing;
    11.         [SerializeField]
    12.         public int amount {
    13.             get => m_backing2;
    14.             private set => m_backing2 = value;
    15.         }
    16.         [SerializeField] private int m_backing2;
    17.     }
    18.  
    I honestly have no idea what an explicit backing field really means, I think I have a guess at it, but this seems to work.
     
  15. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Version 2.6.9.6 has been submitted to the asset store for review. This version includes:
    • Added logic to allow TooltipAttribute to show
     
  16. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Great News! Version 2.6.9.6 is now live on the store!
     
  17. helloroy

    helloroy

    Joined:
    Jun 23, 2016
    Posts:
    42
    Hello, Pro version said "V3 has many modifications made to the system to allow for better data management with less than half of the memory usage of V2.", it's about Unity Editor or compiled game?

    And I want to say thanks that this asset is even better than Odin's Dictionary serialization, and both can work together, Amazing!
     
  18. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Hello!

    I'm glad to know that you like the asset. As for your question, it's about both. There are many difference in how both systems handle their data, but the main point is that the lite has overhead that is not related to a dictionary. You can see it if you serialize your data into a json object. Also lite dictionary cannot be serialized using with BinaryFormatter.

    Here's a quick example that shows how both of them handle the data, note that both of them are using the exact same data (use a json beutifier to see it better)
    Code (CSharp):
    1. Lite dictionary-----------------------------
    2. Json data: {"test":{"reorderableList":{"canAdd":true,"canRemove":true,"draggable":true,"expandable":true,"multipleSelection":true,"isExpanded":false,"label":{"m_Text":"Keys","m_Image":{"instanceID":0},"m_Tooltip":""},"headerHeight":18.0,"footerHeight":13.0,"slideEasing":0.15000000596046449,"verticalSpacing":2.0,"showDefaultBackground":true,"elementDisplayType":0,"elementNameProperty":"","elementNameOverride":"","elementIcon":{"instanceID":0}},"reqReferences":{"instanceID":0},"isExpanded":false,"_keyValues":[0,1,2,3,4,5],"_keys":[0,1,2,3,4,5],"_values":[1,2,3,4,5,6]},"test2":{"reorderableList":{"canAdd":true,"canRemove":true,"draggable":true,"expandable":true,"multipleSelection":true,"isExpanded":false,"label":{"m_Text":"Keys","m_Image":{"instanceID":0},"m_Tooltip":""},"headerHeight":18.0,"footerHeight":13.0,"slideEasing":0.15000000596046449,"verticalSpacing":2.0,"showDefaultBackground":true,"elementDisplayType":0,"elementNameProperty":"","elementNameOverride":"","elementIcon":{"instanceID":0}},"reqReferences":{"instanceID":13814},"isExpanded":false,"_keyValues":[{"val":2147483647},{"val":2147483647},{"val":2147483647},{"val":2147483647},{"val":2147483647},{"val":2147483647}],"_keys":[{"val":2147483647},{"val":2147483647},{"val":2147483647},{"val":2147483647},{"val":2147483647},{"val":2147483647}],"_values":[1,2,3,4,5,6]}}
    3. Json size: 1332
    4. System.Runtime.Serialization.SerializationException: Type 'RotaryHeart.Lib.SerializableDictionary.DrawableDictionary'
    5.  
    6. Pro dictionary-----------------------------
    7. Json data: {"test":{"m_val":7,"m_keys":[0,1,2,3,4,5],"m_values":[1,2,3,4,5,6]},"test2":{"m_val":7,"m_keys":[{"val":2147483647},{"val":2147483647},{"val":2147483647},{"val":2147483647},{"val":2147483647},{"val":2147483647}],"m_values":[1,2,3,4,5,6]}}
    8. Json size: 238
    9. BinaryFormatter size: 5833
    Here's the code used for this example:
    Code (CSharp):
    1. public class NewBehaviourScript : MonoBehaviour
    2. {
    3.     public enum MyEnum
    4.     {
    5.         EnumValue1, EnumValue2, EnumValue3, EnumValue4, EnumValue5, EnumValue6
    6.     }
    7.  
    8.     [System.Serializable]
    9.     public class GenericHolder
    10.     {
    11.         public int val;
    12.     }
    13.    
    14.     [System.Serializable]
    15.     public class LiteHolder
    16.     {
    17.         [System.Serializable]
    18.         public class MyDictionary : SerializableDictionaryBase<MyEnum, int> { }
    19.    
    20.         [System.Serializable]
    21.         public class MyDictionary2 : SerializableDictionaryBase<GenericHolder, int> { }
    22.  
    23.         public MyDictionary test;
    24.         public MyDictionary2 test2;
    25.     }
    26.    
    27.     [System.Serializable]
    28.     public class ProHolder
    29.     {
    30.         [System.Serializable]
    31.         public class MyDictionary : SerializableDictionary<MyEnum, int> { }
    32.    
    33.         [System.Serializable]
    34.         public class MyDictionary2 : SerializableDictionary<GenericHolder, int> { }
    35.  
    36.         public MyDictionary test;
    37.         public MyDictionary2 test2;
    38.     }
    39.  
    40.     public LiteHolder dictionaryLite;
    41.     public ProHolder dictionaryPro;
    42.  
    43.     [ContextMenu("Serialize")]
    44.     public void Serialize()
    45.     {
    46.         Debug.Log("Lite dictionary-----------------------------");
    47.         SerializeObject(dictionaryLite);
    48.         Debug.Log("Pro dictionary-----------------------------");
    49.         SerializeObject(dictionaryPro);
    50.     }
    51.  
    52.     public void SerializeObject(object obj)
    53.     {
    54.         var data = JsonUtility.ToJson(obj);
    55.         Debug.Log($"Json data: {data}");
    56.         Debug.Log($"Json size: {data.Length}");
    57.        
    58.         try
    59.         {
    60.             using (Stream s = new MemoryStream())
    61.             {
    62.                 BinaryFormatter formatter = new BinaryFormatter();
    63.                 formatter.Serialize(s, obj);
    64.                 Debug.Log($"BinaryFormatter size: {s.Length}");
    65.             }
    66.         }
    67.         catch (System.Exception e)
    68.         {
    69.             Debug.LogError(e);
    70.         }
    71.     }
    72. }
    And the data stored on both of them (As you can see it is using the exact same data):
    upload_2022-12-21_20-27-51.png upload_2022-12-21_20-29-31.png
     
    Stexe likes this.
  19. DiogoOli1080

    DiogoOli1080

    Joined:
    Jan 18, 2023
    Posts:
    4
    Hey, I've been using this on a project. When I try to build, it gives me a ton of errors directed to the Serialized dictionary folder. Should I be able to build using this package?

    upload_2023-2-7_17-32-7.png
     
  20. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Hello, yes you definitely can. Note that the folder that is throwing you errors is an editor folder, it shouldn't be included in the build. I have a couple of questions for you

    Are you using any custom build pipeline?
    What Unity version are you using?
    What platform are you build?
     
  21. DiogoOli1080

    DiogoOli1080

    Joined:
    Jan 18, 2023
    Posts:
    4
    Hey, thanks for responding so quickly :D

    So, I'm not using a custom build pipeline, my version is 2021.3.8f1, and I'm building for Windows.
    I didn't know you could exclude folders and files from a build, wow.
    When I imported the package, the folder went into the Assets folder instead of the Packages folder, would that be the issue? Or should I just try to exclude the editor folder from build?
     
    Last edited: Feb 8, 2023
  22. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    I cannot replicate your issue, I was able to make a build without problems using the same Unity version.

    What version of the asset are you using?
    Can you try replicating it in an empty project?
     
  23. DiogoOli1080

    DiogoOli1080

    Joined:
    Jan 18, 2023
    Posts:
    4
  24. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    I see the issue. You've added an asmdef to the asset folder, note that if you do that and not add one to the editor folder when you compile it will try to include the editor file. You'll need to add an asmdef to the editor folder and mark it editor only. Take a look at the RotaryHeart.Editor.asmdef file in Rotary Heart/Shared/Editor for an example
     
  25. DiogoOli1080

    DiogoOli1080

    Joined:
    Jan 18, 2023
    Posts:
    4
    Thanks that did it :D
     
  26. Agent40

    Agent40

    Joined:
    Oct 31, 2020
    Posts:
    3
    Hey, your serialized dictionary has been an amazing help but there seems to be an issue with using it alongside SerializedProperty. I couldn't find anything about there being any issues with it but from the looks of things the propertyheight isn't being calculated properly. upload_2023-3-19_22-27-22.png
    upload_2023-3-19_22-27-53.png
    upload_2023-3-19_22-28-22.png

    It works completely fine by itself but as soon as a SerializedProperty is involved, it breaks completely and refuses to even show in play mode.

    upload_2023-3-19_22-31-3.png

    Update: it works while empty now but as soon as it's filled with any type of data, it can no longer be expanded and is visually skewed
     
    Last edited: Mar 19, 2023
  27. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Can you upload a repro script. I'm failing to replicate the issue, also what Unity version are you using?
     
  28. Agent40

    Agent40

    Joined:
    Oct 31, 2020
    Posts:
    3
  29. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    I couldn't test your scripts since it had some errors, but seems like what you are trying to do will give you problems with many drawers since you are creating many new
    SerialiedObjects
    . What you can do instead is use CreateEditor and draw that editor in your window:

    Code (CSharp):
    1. protected Editor snapshotEditor;
    2.  
    3. void OnEnable()
    4. {
    5.     var snapshot = ScriptableObject.CreateInstance<SnapshotEditor>();
    6.     snapshotEditor = Editor.CreateEditor(snapshot);
    7. }
    8.  
    9. void OnDestroy()
    10. {
    11.     DestroyImmediate(snapshotEditor);
    12. }
    13.  
    14. void OnGUI()
    15. {
    16.     snapshotEditor.OnInspectorGUI();
    17. }
     
  30. Agent40

    Agent40

    Joined:
    Oct 31, 2020
    Posts:
    3
    Sorry there was 1 redundant line, it should work now. Editor cannot be utilised in EditorWindow so are you specifying to create an Editor for SnapshotEditor so that it works within SnapshotEditorWindow?
     
  31. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    No, you can use that code in your editor window and it will draw the appropriate inspector in your window.

    upload_2023-3-21_22-2-54.png
     
  32. SpottedAlien456

    SpottedAlien456

    Joined:
    Sep 21, 2022
    Posts:
    5
    Sorry I am still very new to this but I am having difficulty getting the dictionary to show in the editor. For a basic example, I am trying to create a dictionary in a monobehaivor script attached to a game object.
    Code (CSharp):
    1. using UnityEngine;
    2. using RotaryHeart.Lib.SerializableDictionary;
    3.  
    4. public class Dictionaryscript : MonoBehaviour
    5. {
    6.     [System.Serializable]
    7.     public class DialogueVCamRigDictionary : SerializableDictionaryBase<string, GameObject> { }
    8. }
    I looked through the database example but I am not following the process very well. Do these have to be created in their own class to generate a database object like in the database example?
     
  33. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    You will need to provide more to see what your issue is, how are you using your DialogueVCamRigDictionary? Here you are just showing how yo declared your class, not how you use it.
     
  34. SpottedAlien456

    SpottedAlien456

    Joined:
    Sep 21, 2022
    Posts:
    5
    I am attempting to create a serialized dictionary storing string names and cinemachine vcams. My thought is to pass in a string to a public function in a script attached to a gameobject, reference the dictionary to get the corresponding vcam, and then change the vcam priority. I am limited to strings in the events on the dialogue system I am using.

    Something along these lines:
    Code (CSharp):
    1.   public class DialogueVCamController : MonoBehaviour
    2. {
    3. [System.Serializable]
    4.     public class DialogueVCamRigDictionary1 : SerializableDictionaryBase<string, GameObject> { }
    5.  
    6.     public void SetVCam(string cameraName)
    7.     {
    8.         //use cameraName to get serialized vcam
    9.         vCam.Priority = 99;
    10.     }
    11.  
    12.     public void DeselectVCam(string cameraName)
    13.     {
    14.         //use cameraName to get serialized vcam
    15.         vCam.Priority = 10;
    16.     }
     
    Last edited: Jun 5, 2023
  35. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Without seeing more of your script, it's hard to tell if you are having any kind of issue. All you need is to have a serialize field of your class for it to show in your inspector:

    Code (CSharp):
    1. using UnityEngine;
    2. using RotaryHeart.Lib.SerializableDictionary;
    3. public class Dictionaryscript : MonoBehaviour
    4. {
    5.     [System.Serializable]
    6.     public class DialogueVCamRigDictionary : SerializableDictionaryBase<string, GameObject> { }
    7.     [SerializeField]
    8.     DialogueVCamRigDictionary myDictionary;
    9. }
     
  36. SpottedAlien456

    SpottedAlien456

    Joined:
    Sep 21, 2022
    Posts:
    5
    I was missing the
    Code (CSharp):
    1.     [SerializeField]
    2.     DialogueVCamRigDictionary myDictionary;
    Thank you for your help
     
  37. DStecks

    DStecks

    Joined:
    Oct 14, 2015
    Posts:
    3
    Hi, just wanted to say, huge fan of this asset! Been using it for years, it's absolutely vital to me. Which is why it's so troubling that I'm now getting a strange error when a SerializableDictionary is visible in an inspector:

    NullReferenceException: Object reference not set to an instance of an object
    RotaryHeart.Lib.SerializableDictionary.DictionaryPropertyDrawer.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/Unity Store Assets/Rotary Heart/SerializableDictionaryLite/Editor/DictionaryPropertyDrawer.cs:324)

    To save you the time of looking it up, this is the line in the code that the error is pointing to:
    upload_2024-1-7_18-14-9.png
     
    Stexe likes this.
  38. DStecks

    DStecks

    Joined:
    Oct 14, 2015
    Posts:
    3
    Update: I've made some progress. The problem seems to be caused by me using a
    SerializableDictionaryBase<string, List<[my object]>> . Making a dictionary of an object which holds the list does not cause the bug, but it does add an unneeded layer to my code. I tried making a class which inherits from List<[my object]> but then it doesn't serialize at all, even though I put [Serializable] in front of all of the classes involved.

    Currently, I can move forward, but if I'm just doing something wrong in how I tried to make a Dictionary of Lists, I'd love to know what that is so that I can do that directly, instead of having the wrapper object.
     
    Stexe likes this.
  39. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Hello,

    I'm glad to know the asset is useful to you. You are not doing anything wrong, that's just unfortunately how Unity serialization works. You'll have to use a wrapper class for arrays/lists, since unity does not serialize nested arrays/lists.
     
    Stexe likes this.
  40. unity_924C2C1616F4F54F56AF

    unity_924C2C1616F4F54F56AF

    Joined:
    Sep 27, 2023
    Posts:
    3
    Hello,
    First of all, thank your for making this plugin free.
    I've been using it quite around one of my scripts, got no issues, until now for some reason.

    When i create a dictionnary using
    SerializableDictionaryBase
    , whatever the key and value type is, when I try to create the first key&value in the inspector, i get a ton of errors.
    The variable is not nested, its at the base of my script class.

    here is the code

    Code (CSharp):
    1. [System.Serializable] public class VerticalSpecificHeight : SerializableDictionaryBase<string, float> { }
    2.     public VerticalSpecificHeight specificHeight;
    using 2022.3.4f1

    also, when reloading, the error is fixed, the key i tried adding before the "crash" appears, and I can add as many keys as I want with no problem.

    Console:
    upload_2024-1-15_8-2-57.png

    Details about the first error to appear:


    IndexOutOfRangeException: Index was outside the bounds of the array.
    RotaryHeart.Lib.SerializableDictionary.ReorderableList.DoList (UnityEngine.Rect rect, UnityEngine.GUIContent label, System.Boolean enablePages, System.Int32 perPageCount) (at Assets/Rotary Heart/SerializableDictionaryLite/ReorderableList/ReorderableList.cs:324)
    RotaryHeart.Lib.SerializableDictionary.DictionaryPropertyDrawer.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at Assets/Rotary Heart/SerializableDictionaryLite/Editor/DictionaryPropertyDrawer.cs:350)
    UnityEditor.PropertyDrawer.OnGUISafe (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
    UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
    UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
    UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
    UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
    NaughtyAttributes.Editor.NaughtyEditorGUI.DrawPropertyField_Layout (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs:39)
    NaughtyAttributes.Editor.NaughtyEditorGUI.PropertyField_Implementation (UnityEngine.Rect rect, UnityEditor.SerializedProperty property, System.Boolean includeChildren, NaughtyAttributes.Editor.NaughtyEditorGUI+PropertyFieldFunction propertyFieldFunction) (at Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs:71)
    NaughtyAttributes.Editor.NaughtyEditorGUI.PropertyField_Layout (UnityEditor.SerializedProperty property, System.Boolean includeChildren) (at Assets/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs:29)
    NaughtyAttributes.Editor.NaughtyInspector.DrawSerializedProperties () (at Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs:87)
    NaughtyAttributes.Editor.NaughtyInspector.OnInspectorGUI () (at Assets/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs:47)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass72_0.<CreateInspectorElementUsingIMGUI>b__0 () (at <da771086bc2e4cfc9ad0a72e083a7f98>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)
     
  41. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Hello,

    Can you replicate it on an empty project and attach it here? I'm having trouble replicating the issue
     
  42. unity_924C2C1616F4F54F56AF

    unity_924C2C1616F4F54F56AF

    Joined:
    Sep 27, 2023
    Posts:
    3
    It seems to be a bug related to the coexistence of two plugins: yours and NaughtyAttributes.
    I'll try fixing this alone since its not your problem.

    thank your for your fast response.



    EDIT: rebooting the project solved the issue, maybe because i removed the issue.
     
  43. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    I'm glad the issue is resolved
     
  44. r31ack

    r31ack

    Joined:
    Mar 24, 2022
    Posts:
    4
    Hello, I find your assets very useful.
    When I build using AddressableAsset, an error message like that sometimes appears.
    Even if an error occurs, there doesn't seem to be a problem with the build, but it's difficult to find where it came from.
    This doesn't happen to everything.
    I think I'm missing a link in the inspector... but I can't find where the error occurred.
    I am leaving an inquiry because I am curious to know if there is any speculation as to the cause.
    It can be assumed that this is a problem that occurs when building with something missing when using Enum as a key value in the Unity Inspector. (Not accurate.)
     

    Attached Files:

    • bug.png
      bug.png
      File size:
      154.5 KB
      Views:
      12
  45. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    This is the first time I've seen this report. I tried to replicate it but cannot make it happen. If you manage to make a small repro project feel free to attach it and I can investigate what might be happening
     
  46. r31ack

    r31ack

    Joined:
    Mar 24, 2022
    Posts:
    4
    Thank you for your reply... I don't think it will be easy to reproduce.
    Because there is no problem with this right now
    I will contact you again regarding this matter after I finish up my other urgent matters.
     
  47. r31ack

    r31ack

    Joined:
    Mar 24, 2022
    Posts:
    4

    Hello, I am attaching a reproducible code that generates an error message when building.
    I created a Template type for convenience in setting key values in the Unity Inspector. (In fact, it works fine if you ignore the error message.)


    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class MenuButtonGroupController : MenuButtonGroupBase<string> { }
    4.  
    5. public class MenuButtonGroupBase<T> : MonoBehaviour
    6. {
    7.     [SerializeField] SerializableDictionaryBase<T, Button> _buttons = null;        
    8. }

    Using "MenuButtonGroupController" in Unity Inspector
     
  48. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    This seems like is not giving me the issue either. I can build both addressables or the project without problems