Class SerializedDictionary<K, V>
Unity can't serialize Dictionary so here's a custom wrapper that does. Note that you have to extend it before it can be serialized as Unity won't serialized generic-based types either.
Implements
IDictionary<K, V>
ICollection<KeyValuePair<K, V>>
IReadOnlyDictionary<K, V>
IReadOnlyCollection<KeyValuePair<K, V>>
IEnumerable<KeyValuePair<K, V>>
Inherited Members
Namespace: UnityEngine.Rendering
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
[Serializable]
public class SerializedDictionary<K, V> : SerializedDictionary<K, V, K, V>, IDictionary<K, V>, ICollection<KeyValuePair<K, V>>, IReadOnlyDictionary<K, V>, IReadOnlyCollection<KeyValuePair<K, V>>, IEnumerable<KeyValuePair<K, V>>, IDictionary, ICollection, IEnumerable, IDeserializationCallback, ISerializable, ISerializationCallbackReceiver
Type Parameters
Name | Description |
---|---|
K | The key type |
V | The value |
Examples
public sealed class MyDictionary : SerializedDictionary<KeyType, ValueType> {}
Methods
Name | Description |
---|---|
DeserializeKey(K) | Conversion to serialize a key |
DeserializeValue(V) | Conversion to serialize a value |
SerializeKey(K) | Conversion to serialize a key |
SerializeValue(V) | Conversion to serialize a value |