Save Data (Serialize)

Learn how to save data

For using this plugin methods you need to import the required namespace. Please include the below statement at namespace include list

using VoxelBusters.Serialization;

We provide a generic method to save(Serialize) any kind of data. For serializing data you need to specify a key. This key is used to retrieve the data back again during deserialization.

Performance Tip : For Int, Float and String we provide direct methods to serialize and deserialize to get best performance when compared to generic method call. So, if possible try to use direct call if applicable.

Examples

Save Int

SerializationManager.Serialize<int>("myInt",123);

Save Float

SerializationManager.Serialize<float>("myFloat",111.11f);

Save Double

SerializationManager.Serialize<double>("myDouble",129.0);

Save String

SerializationManager.Serialize<string>("myString","string value");

Save GameObject

SerializationManager.Serialize<GameObject>("gameObject",gameObjectInstance);

Save List

List<GameObject> gameObjectsList = new List<GameObject>();
....
....
....
SerializationManager.Serialize<List<GameObject>>("gameObjects", gameObjectList);

Video Tutorials

Last updated