Supported types
The complete list of field types that survive a save and load round trip, including Unity value types, collections and nested objects.
Captured directly, with values that survive a round trip#
| Kind | Types |
|---|---|
| Scalars | bool, byte, sbyte, short, ushort, int, uint, long, ulong, float, double, decimal, char, string |
| Time and identity | DateTime, DateTimeOffset, TimeSpan, Guid |
| Unity values | Vector2/3/4, Vector2Int, Vector3Int, Quaternion, Color, Color32, Rect, RectInt, Bounds, BoundsInt, LayerMask |
| Curves | AnimationCurve, Gradient — captured and restored |
| Enums | Stored by name, so reordering members does not change what a save means |
| Nullables | int?, MyEnum?, Vector3? and so on |
| Collections | T[], List<T>, HashSet<T>, Queue<T>, Stack<T>, Dictionary<TKey,TValue> where the key is a string, integer, char, enum or Guid |
| Nested objects | Plain classes and structs whose own fields are supported, up to the capture depth limit |
| References | GameObject, Component, assets derived from PersistableScriptableObject — stored as the target's persistent id |
| GameObjects | Identity, transform (local position, rotation, scale) and each supported component on it |
Why enums are stored by name#
A numeric enum value means "the fourth thing in this list". Insert a member in the middle and every old save now means something else — silently. Storing the name costs a few bytes and makes a save mean what it said.
Numbers and dates are written culture-independently#
Timestamps and decimals are written in a round-trip, invariant form. This was not a theoretical concern: an early AOT run in a built player wrote timestamps using the current culture, so a save written on a device using dd-MM-yyyy could be reinterpreted elsewhere. It is fixed and covered by tests that impose deliberately hostile cultures and inspect the bytes. Verified
Next#
- Unsupported types — what is refused, and the alternative to use instead.
- References — how reference fields resolve.
- Serialization — the layer underneath all of this.
Something wrong on this page? Every page here describes behaviour that is checked in the repository. If a page and the package disagree, the package wins.
Report a documentation problem · Frequently asked questions · Troubleshooting