• Stars
    star
    126
  • Rank 284,543 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created over 8 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SerializableCollections(SerializableDictionary, SerializableLookup, SerializableTuple) for Unity

SerializableDictionary

SerializableDictionary(SerializableCollections) is fast, native serializable collections for Unity, includes SerializableDictionary, SerializableLookup, SerializableTuple.

What is this?

If using C# deserialization in Unity, it is slow than native serialization process such as ScriptableObject but Unity's native serialization does not support dictionary and llookup(multi dictionary). SerializableDictionary provides native dictionary serialize and deserialize, it is extreme fast.

How to use

Download Zip or clone GithHub and put under Assetss/SerializableCollections in your project. You have to inheritant SerializableDictionary<TKey, TValue> for serialization, for example TKey:Int, TValue:string is

[Serializable]
public class IntStringSerializableDictionary : SerializableDictionary<int, string>
{

}

and shows inspector

#if UNITY_EDITOR

[UnityEditor.CustomPropertyDrawer(typeof(IntStringSerializableDictionary))]
[UnityEditor.CustomPropertyDrawer(typeof(IntDoubleSerializableDictionary))]
[UnityEditor.CustomPropertyDrawer(typeof(IntIntStringSerializableDictionary))]
public class ExtendedSerializableDictionaryPropertyDrawer : SerializableDictionaryPropertyDrawer
{

}

#endif

image

currenly only supports viewer, edit in inspector plans future releases.

Multiple Key Dictionary

You have to use SerializableTuple.

[Serializable]
public class IntIntTuple : SerializableTuple<int, int>
{
    public IntIntTuple()
    {

    }

    public IntIntTuple(int item1, int item2)
        : base(item1, item2)
    {

    }
}

[Serializable]
public class IntIntStringSerializableDictionary : SerializableDictionary<IntIntTuple, string>
{

}

and Tuple is key for SerializableDictionary.

SerializableLookup

ILookup is MultiDictionary(like Dictionary[Key, Value[]). You can use SerializableLookup like lookup builder.

[Serializable]
public class IntIntSerializableLookup : SerializableLookup<int, int>
{
}

#if UNITY_EDITOR

[UnityEditor.CustomPropertyDrawer(typeof(IntIntSerializableLookup))]
public class ExtendedSerializableLookupPropertyDrawer : SerializableLookupPropertyDrawer
{

}

#endif

TrimExcess

TrimExcess of SerializableDictionary, SerializableLookup cut the buffer and reduce memory usage.

License

under the MIT Licesne. Dictionary's original code is from dotnet/corefx, check the original license.

More Repositories

1

UniRx

Reactive Extensions for Unity
C#
7,033
star
2

MessagePack-CSharp

Extremely Fast MessagePack Serializer for C#(.NET, .NET Core, Unity, Xamarin). / msgpack.org[C#]
C#
4,721
star
3

ZeroFormatter

Infinitely Fast Deserializer for .NET, .NET Core and Unity.
C#
2,381
star
4

Utf8Json

Definitely Fastest and Zero Allocation JSON Serializer for C#(NET, .NET Core, Unity, Xamarin).
C#
2,355
star
5

LINQ-to-GameObject-for-Unity

LINQ to GameObject - Traverse GameObject Hierarchy by LINQ
C#
798
star
6

MarkdownGenerator

Generate markdown from C# binary & xml document for GitHub Wiki.
C#
192
star
7

LightNode

Micro RPC/REST Framework built on OWIN
C#
181
star
8

MicroResolver

Extremely Fast Dependency Injection Library.
C#
176
star
9

linq.js

LINQ for JavaScript.
JavaScript
128
star
10

EtwStream

Logs are event streams. EtwStream provides In-Process and Out-of-Process ObservableEventListener. Everything can compose and output to anywhere by Reactive Extensions.
C#
125
star
11

PhotonWire

Typed Asynchronous RPC Layer for Photon Server + Unity
C#
118
star
12

AsyncOAuth

Portable Client Library and HttpClient based OAuth library, including all platform(for PCL).
C#
101
star
13

HyperMapper

An alternative to AutoMapper, Hyper fast object-to-object mapper built on fastest serializer technology.
C#
92
star
14

LINQ-to-BigQuery

LINQ to BigQuery is C# LINQ Provider for Google BigQuery. It also enables Desktop GUI Client with LINQPad and plug-in driver.
C#
85
star
15

ChainingAssertion

Method Chaining base UnitTesting Extension Methods and Dynamic Private Accessor for MSTest, NUnit, xUnit.net.
C#
75
star
16

FastHashtable

Infrastructure for high performance code.
C#
64
star
17

Open-on-GitHub

Visual Studio Extension for opening files on GitHub, GitLab, Gitea, Bitbucket and AzureDevOps (dev.azure.com, visualstudio.com, tfs)
C#
56
star
18

MySqlSharp

Extremely Fast MySQL Driver for C#, work in progress.
C#
55
star
19

NotifyPropertyChangedGenerator

Roslyn Analyzer/Generator for avoid boring boilerplate INotifyPropertyChanged implementation.
C#
52
star
20

DatadogSharp

Yet another C# Datadog client that supports DogStatsD and APM.
C#
41
star
21

ReMotion

Hyper Fast Reactive Tween Engine for Unity
C#
39
star
22

DynamicJson

dynamic json structure for C# 4.0.
C#
37
star
23

RespClient

RespClient is a minimal RESP(REdis Serialization Protocol) client for C# and PowerShell.
C#
32
star
24

OwinRequestScopeContext

Owin Middleware it is possible to RequestScopeContext like HttpContext.Current but no dependent System.Web.
C#
29
star
25

Resume

My Resume
21
star
26

Blog2

C# Static Site Generator and Hosting for neue.cc
C#
16
star
27

ObserveEveryValueChanged

Voodoo Magic for WPF.
C#
13
star
28

MemcachedTranscoder

C# Memcached Transcoders
C#
8
star
29

AnonymousComparer

Lambda compare selector for Linq
C#
7
star
30

Owin.RedisSession

Redis Session Provider for Owin.
C#
5
star
31

neuecc

5
star
32

MSBuildAssemblyLoadIssue

C#
4
star
33

DbExecutor

Simple and Lightweight Database Executor
C#
4
star
34

EsaClient

esa.io client for .NET Standard.
C#
3
star
35

XStreamingReader

Xml Stream(XmlReader) to IEnumerable for Windows Phone(memory save) or parse large Xml.
C#
3
star
36

ImplicitQueryString

Magic for QueryString parsing.
C#
2
star
37

ReactiveOAuth

OAuth library for .NET Framework 4 Client Profile, Silverlight 4 and Windows Phone 7.
C#
2
star