Skip to content

A serializable Dictionary and property drawer for the Unity Editor.

License

Notifications You must be signed in to change notification settings

sim2kid/UnitySerializedDictionary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity Serialized Dictionary

A serializable Dictionary and property drawer for the Unity Editor, modeled visually after the Odin serialized dictionary.

alt text

Credits

This project is an extension of Sterberino's Original Work and aims to maintain and expand this project as needed for myself and others. Please also check out Their GitHub Page and show them support.

How It Works

It uses ISerializationCallbackReceiver to convert keys and values to serializable lists in the background, to allow for dictionary serialization in the editor. Mostly uses switch statements to identify the type and handle drawing the editor fields and serializing/de-serializing values. It allows for dynamically changing dictionary value types at runtime, and it supports:

Installation

  1. Open up Unity's Package Manager ( Window > Package Manager )
  2. In the top left, hit the +(plus) button and select Add package from git URL...
  3. In the box, paste the package's git repository, then hit Add

Repo Link:

https://github.com/sim2kid/UnitySerializedDictionary.git?path=Assets/Scripts/Package/UnitySerializedDictionary To set a target version, use the release tag like #1.0.0 at the end of the repo string.

How To Use

There are two primary scripts you can use to use this package. The Blackboard object allows for a map of string to any of the supported values. This can then be accessed as a Dictionary<string, object> type.

You can also specify specific Dictionary types if wanted. To do so, you'll define your dictionary as a type, then define a property drawer in an editor file.

Create a Dictionary Type

// TODO: Finish

Create a DictionaryDrawer

// TODO: Fill In
[CustomPropertyDrawer(typeof(<DRAWER TYPE>))]
public class <NAME>Drawer : DictionaryDrawer<string, <TYPE>> { }

About

A serializable Dictionary and property drawer for the Unity Editor.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published