Supported Data Types
Using this system, you can serialize / deserialize any type of data, howerer for some special cases, you may need to create a custom Object Converter to serialize that certain data type, because the system uses reflection to get the serializable fields and properties of a data type, while it is reliable, some classes have special use cases that may cause issue during this kind of process, so it is recommended if you face any problems with the data you're saving, get in touch with the support, or try to create a custom object converter for that type.
Providing a list for all supported data types would be a huge one, because the system is capable of saving any data type, but here are some explantation of how this works and what you can do to improve it.
A Quick Overview
Here is a quick overview of supported data types:
- GameObjects
- Components / MonoBehaviours (Colliders, Custom scripts, Transforms, Renderers, ...)
- Assets (Texture, Material, Mesh, ...)
- ScriptableObjects
- Primitive types (strings, enums, numbers, ...)
- Collections (Array, Multi Dimensional Array, Dictionary, List, Stack, Queue, ...)
- C# classes, structs, ...
Unity Objects
You can save and load almost all Unity objects out of the box, but some components will need some custom converters for optimal case, for example, you may be using a third-party package like TextMeshPro and willing to save that component, this way, the system internally serializes all of its fields and properties while it may not be what you want, this is what happesn without having a custom converter, but once you use a custom converter, you can specify which fields and properties to be saved so you can only save required data.
The system serializes Unity objects with a reference, so here are scenarios that will have different outcomes:
- Scene objects will be serialized with both a reference and all of their data
- Assets will be serialized only with their reference but if they are a ScriptableObject and Serialize ScriptableObject option is enabled, then their data will be serialized too
This way, when you're serializing a GameObject in your scene that has a reference to a Texture in the project, then that Texture's data won't be serialized but a single reference to it will be serialized, so when you load it back, it quickly loads the reference to it and returns that object inside your project without reconstructing the object from scratch.
But if there are certain objects, that do not have any reference from Asset Reference Manager, then they'll be serialized fully with all their data, whether that is a Texture, Material, Mesh, or any type of asset.
C# Objects
All of the C# objects can be serialized, even if they have a reference to Unity objects.
But the same scenario of Unity objects applies to C# objects, some of them may need a custom converter for optimal serialization.