[Released] Serializable Dictionary Pro

Serializable Dictionary Pro

Website: RotaryHeart.com
Product Wiki: Online

Version 3.4.4
Available Now: Asset Store
Release Notes

Lite Version: Thread

Serialized Dictionary Pro is an easy to use system that allows to make serializable dictionaries on Unity. There are no limitations on key or value types other than Unitys own serialization limitations.

Main Pro Features

  • Now with 6 different data types, not just Dictionaries

  • System has been completely modified to use way less memory

  • Can now be converted to Json without including any extra data or any extra step

  • No reflection and required references field used for keys

  • Editor callbacks for ItemRemoved, ItemAdded, ElementDrawn, ItemsReordered, and EntryEdited

  • New constructor values to block adding items, removing items, items reorder, and make it read only

  • Faster deserialization logic thanks to not using reflection

Features

  • Reordering of items (Drag & Drop)
  • Pages System
  • Custom key or value drawer

Data structures are separated into their own class:

[System.Serializable]
public class MyDictionary : SerializableDictionary<Key, Value> { }
[System.Serializable]
public class MyDictionary : SerializableOrderedDictionary<Key, Value> { }
[System.Serializable]
public class MyDictionary : SerializableSortedDictionary<Key, Value> { }
[System.Serializable]
public class MyDictionary : SerializableHashSet<Key> { }
[System.Serializable]
public class MyDictionary : SerializableBiDictionary<Key, Value> { }
[System.Serializable]
public class MyDictionary : SerializableLinkedList<Key> { }

Awesome and it came out on my birthday too. Looking forward to checking it out. =)

1 Like

Happy birthday! I will make sure to update the thread once it has been acepted

1 Like

Great news, Asset is now live on the Asset Store! Serialized Dictionary PRO | Utilities Tools | Unity Asset Store

Version 3.0.1 has been submitted to the asset store for review. This version includes:

  • Fix for BinaryFormatter that was serializing editor only actions.
  • Implemented missing functionality for SerializableHashSet
  • Fixed with code documentation for better readability

Great News! Version 3.0.1 is now live on the store

1 Like

Version 3.0.2 has been submitted to the asset store for review. This version includes:

  • Modified definer for a more generic method.
  • Fixed editor drawer indenting bug.

Great News! Version 3.0.2 is now live on the store

1 Like

Version 3.1.0 has been submitted to the asset store for review. This version includes:

  • Fixed documentation
  • New attribute that allows to specify what default value to use for a dictionary key for new elements

Great News! Version 3.1.0 is now live on the store

30% off with the new year sale!

Don’t miss your opportunity!

1 Like

Sale ending soon, don’t miss the opportunity!

Hi,

I find Lite ver and Pro ver operation is not the same
The Lite ver when add new Data will auto gray used item, and select not used item,
but Pro ver when add new Data not auto gray item, and seems select first itme , may only except null.
Could you take a look?

Lite ver
6701659--769441--Lite.png

Pro ver
6701659--769444--Pro.png

public enum Side
    {
        Null = -1,
        Right = 0,
        TopRight = 1,
        Top = 2,
        TopLeft = 3,
        Left = 4,
        BottomLeft = 5,
        Bottom = 6,
        BottomRight = 7
    }

    [System.Serializable]
    public class DictionarySideHitLimits : SerializableDictionaryBase<Side, int> { }
    [SerializeField]
    DictionarySideHitLimits _SideHitLimits;
    public IDictionary<Side, int> m_SideHitLimits
    {
        get { return _SideHitLimits; }
        set { _SideHitLimits.CopyFrom(value); }
    }

Thanks for the report, will be taking a look at that.

Version 3.1.1 has been submitted to the asset store for review. This version includes:

  • Fix for enum limitation while adding a new element

@Timmy-Hsu This update fixes the issue you reported.

1 Like

Great News! Version 3.1.1 is now live on the store!

Hi:
I recently bought your Pro version and I’m having a strange behavior when I try to remove things from the dictionary by code:
I have:
public class myClass: SerializableDictionary<Vector2,int>{}

Then i have:

myClass myOwnDict = new myClass(){
{ Vector2.zero,7 },
{ Vector2.one,9 },
{ Vector2.one*2,11 }
};

But if I try:

myOwnDict.Remove(Vector2.one)

It removes the last key I added (in this case, the Vector2.one*2)

It seems to depend on the order of the dictionary in the editor, which is not what is to be expected. Am I doing something wrong?

Thanks

I now managed to make it work properly. What changed is that I was using 2 inspectors, one locked on the Scriptable object containing the dictionary, and the other (unlocked) inspecting the object that I use in the editor to read the scene events and modify the dictionary accordingly. I unlocked both inspectors, and It worked.

Very strange, but in any case, I know how to make it work now.

1 Like

Interesting behaviour. I will keep an eye on that, thanks for your report.

I have successfully created and added to a serializedDictionary:

using RotaryHeart.Lib.SerializableDictionary;
using UnityEngine;

namespace Optkl.Data
{
    [CreateAssetMenu()]
    public class SingleStrike : ScriptableObject
    {
        [SerializeField]
        private MainDict strikeData;

        public MainDict StrikeData
        {
            get
            {
                return strikeData;
            }
            set
            {
                strikeData = value;
            }
        }

        [System.Serializable]
        public class StrikeMinMax
        {
            public float maxStrike;
            public float minStrike;
        }

        [System.Serializable]
        public class MainDict : SerializableDictionaryBase<string, StrikeMinMax> { }

        public void Add (string expireDate, StrikeMinMax strikeMinMax)
        {
            strikeData.Add(expireDate, strikeMinMax);
        }
    }
}
SingleStrike.StrikeMinMax strikeValues = new SingleStrike.StrikeMinMax();
strikeValues.maxStrike = maxStrike;
strikeValues.minStrike = minStrike;
strike.Add(prevDateTime, strikeValues);

I have also successfully converted this to a nested dictionary:

using RotaryHeart.Lib.SerializableDictionary;
using UnityEngine;

namespace Optkl.Data
{
    [CreateAssetMenu()]
    public class DataStrike : ScriptableObject
    {

        [SerializeField]
        public MainDict tradeDate;
    }

    [System.Serializable]
    public class StrikeData
    {
        public NestedDict expireDate;
    }

    [System.Serializable]
    public class StrikeMinMax
    {
        public float strikeMax;
        public float strikeMin;
    }

    [System.Serializable]
    public class MainDict : SerializableDictionaryBase<string, StrikeData> { }

    [System.Serializable]
    public class NestedDict : SerializableDictionaryBase<string, StrikeMinMax> { }


}

But I can’t figure out the steps to add data to the nested database. It’s quite a bit more complex than I thought it would be. How do I modify my code from the single entry to the nested one?

Thank you

Dan

Thank you