| | Converts a Dictionary<TKey,TValue>—whose values may be a heterogeneous mix of primitives, enums, Unity structs, arrays, or List<T>—to JSON and back.
✔ Supported value types
-
Primitives (
int, float, double, bool, long, char, decimal)
-
string
-
Enums (serialised by
ToString())
-
Unity structs/classes that
[SerializeField]/[Serializable] work with (e.g. Vector3, Quaternion)
-
1-D arrays or List<T> of any supported element type
✖ Not supported (will default)
-
Nested collections (e.g.
List<List<int>>)
-
Dictionary or other key–value containers
-
Multi-dimensional arrays
-
Polymorphic references where run-time type ≠ declared type
Gotchas
-
Large simple arrays/lists allocate when joined/split—pool if you save every frame.
-
IL2CPP stripping: ensure every generic instantiation you rely on (
List<YourStruct>) appears in code or link.xml.
-
Culture is forced to CultureInfo.InvariantCulture; changing this breaks comma-decimal locales.
More...
|