Features And Limitations

Odin's serialization is currently supported on all platforms, save the Universal Windows Platform in non-IL2CPP builds. Note that when using Odin's serialization on IL2CPP or Mono AOT platforms, you have to follow a special AOT procedure to make Odin's serialization work right in builds.

By default, Odin's serialization system will serialize any public field, or any private field marked with SerializeField, that Unity would not serialize. As such, you generally don't need to think much about it; it'll fill in the gaps where necessary. However, if you do need to make sure a specific member is always serialized by Odin, you can mark any field or auto-property with the Odin-specific OdinSerialize attribute to ensure that.

Odin supports serializing a wide range of types, from dictionaries to delegates. In fact, Odin will, by default, attempt to serialize pretty much anything you hand it. In most cases, this will work fine, and in some cases it won't. For the cases where it won't, it is possible to manually extend the serialization so it does.

The serialization system supports a range of data formats, and also lets you create your own. By default, Odin comes with three formats: binary, json, and nodes.

Binary

The binary format is to be used when performance is required; it is optimized for speed and for keeping garbage allocations at a minimum. By default, it will be used in play mode, and in builds.


Json

The json format is never used by default, but is supported for the cases where you want to do manual serialization of something and you want the serialized data to be human-readable. It is important to note that the json format does not have optimal performance, and allocates a lot of unnecessary garbage in the current version of Odin. Longer term, some performance improvements are in order. For now, only use the json format where it is necessary.


Nodes

This format is the default in the editor, while not in play mode. It is a special format that doesn't serialize to a stream of bytes, but instead to a list of nodes that Unity then serializes - it is meant to be used in conjunction with the Unity editor's text asset serialization. When used with Unity's text format, the node data will be formatted in the file such that it is mergeable in source control, making this format advisable for use in projects with multiple collaborators. The node format is generally fairly performant in most cases, but is not as fast as the binary format, and is by default only allowed to be used in the editor.