Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

[Released] Dictator - Dictionary support done right

Discussion in 'Assets and Asset Store' started by astrokoala, Sep 24, 2017.

  1. astrokoala

    astrokoala

    Joined:
    Mar 23, 2016
    Posts:
    22
    Introducing Dictator - Unity Dictionary support done right

    Features
    • Supports serialization and deserialization
    • nice looking property drawer that takes minimal space in the inspector
    • Adjustable Key value display size
    • Supports Nesting
    • No need to write Editor class, just declare your type and use
    • Supports any type
    • Drag and drop reorders elements
    • Performance is the same as Dictionary, it uses Dictionary under the hood
    • API is the same as Dictionary, no new API to learn
    How Dictator differs to other solutions on the market
    • Aesthetics - Dictator uses unity built in drawer to display Dictionary, it blends right in, it feels like its natively supported
    • Real Dictionary - not faked like double list, the keys have to be unique, and you can use anything as key. The API is exactly the same, if you already have dictionary in your code, its really easy to switch to Dictator.
    • No setup required - All* of other solutions requires you to write another "Editor class" in addition to declare your own Dictionary class, with dictator, you just declare your class and thats it
    Here is an example setup
    Code (CSharp):
    1. [Serializable]
    2. public class MyDictionary : Dict<type, type>{}
    If you read this far, you are probably interested, I'm offering 10 free keys for people who are willing to write honest review, please PM me about it
     

    Attached Files:

  2. astrokoala

    astrokoala

    Joined:
    Mar 23, 2016
    Posts:
    22
    Updated to support from unity 5.3 and up
     
  3. exiguous

    exiguous

    Joined:
    Nov 21, 2010
    Posts:
    1,749
    I was one of them ;). I have tested and reviewed the product. Clearly recommended when you need to work with dictionaries in Unity (who doesn't?).
    Thanks for the Key astrokoala.
     
  4. dousi96

    dousi96

    Joined:
    Jul 28, 2014
    Posts:
    23
    Hi,

    I've just bought this plugin because i have a lot of problems in trying to implements Dictionary compatible with Unity Inspector.
    I've tried this int my project but it doesn't seem to be atapt to my problem.
    I cant inspect the second nested dictionary and sometimes it gives me some strange errors in the console.
    (Another small bug: the foldoutArrow is inside the key field)


    DictProblem.jpg

    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class PlayerController : TankStateController //it's monobehaviour
    6. {
    7.     public CiaoClips ciao;
    8.     public CiaoClipsDict ciaoDict;
    9. }
    10.  
    11. [Serializable]
    12. public class Clips
    13. {
    14.     [SerializeField]
    15.     public List<AudioClip> collection;
    16.  
    17.     public Clips() : base()
    18.     {
    19.         collection = new List<AudioClip>();
    20.     }
    21. }
    22.  
    23. [Serializable]
    24. public class LocClips : Dict<SystemLanguage, Clips> { }
    25.  
    26. [Serializable]
    27. public class CiaoClips
    28. {
    29.     [SerializeField, Range(0, 100)] private int priority;
    30.     [SerializeField] private LocClips collection;
    31. }
    32.  
    33. [Serializable]
    34. public class CiaoClipsDict : Dict<string, CiaoClips> { }
    If someone can help me please reply!

    Last thing, I think that implementing a constructor for the Dict class would be nice in order to have more control on the usage of the dict class.

    Thank you
     
    Last edited: May 3, 2018