Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

RedHelium/Data-Serialization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Serialization

Data Serialization

Binary, XML and JSON (Only for Unity) Serialization

Usage

  1. using RedHeliumGames.IO namespace
  2. Create an instance of the FileManager class.
    1. Call Save(T data) function for save your serialization object
    2. Call T Load() function for load your serialization object from file

Example

//This is example serialization structure
[Serializable]
public struct TestStruct
{
    public int a;
    public string b;

    public TestStruct(int a, string b)
    {
        this.a = a;
        this.b = b;
    }
}

private void Start()
{
   // Create FileManager
   FileManager fileManager = new FileManager(Path.Combine(Application.dataPath, "test123.bin"), 
   FileManager.SerializerType.Binary);
   
   //Initialize testing serialization object
   test = new TestStruct() { a = 25, b = "Hello" };
  
   //Save our structure
   fileManager.Save(test);

   // Output loaded data from file
   print(fileManager.Load<TestStruct>().a);
}

About

Binary, XML and JSON (Only for Unity) Serialization

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages