Skip to main content

Class SaveDataFormat

Concrete base class for all types that can be serialised and written to disk by SaveData.

public class SaveDataFormat

Inheritance​

Derived​

UserIdManager.UserData

Remarks​

JsonUtility.ToJson requires a concrete class — it cannot serialise an interface or an abstract base. SaveDataFormat is that concrete root: all custom save payloads must inherit from it so that the generic constraints on SaveData.WriteData<T> and Boolean) can enforce that only serialisable types are passed to the save pipeline.

The class itself is intentionally empty — it adds no fields. Its sole purpose is to act as a common type token so the save system can accept any subclass without needing to know its concrete shape. Extend it with public fields (not properties — JsonUtility ignores properties) to store custom data.

The built-in subclasses (IntFormat, FloatFormat, StringFormat) wrap individual primitive values so that callers can persist a single number or string without writing a dedicated wrapper class. They are declared internal because they are implementation details of the save system, not part of the public API.