Skip to main content

DataSection.Load

Declaration#

public virtual void Load(string filename, Action onComplete)

Parameters#

NameDescription
filenameFull path of file to load
onCompleteAction to invoke when load is complete

Description#

Loads full data from a file

Usage#

Example
using NullSave.GDTK;using System.IO;using UnityEngine;
public class CodeSample : MonoBehaviour{
    public void ExampleMethod()    {        // You can create your own DataSections to work with        DataSection target = new DataSection();
        // Data can be loaded directly from a file        // You can invoke an action when save is complete        target.Save(Path.Combine(Application.persistentDataPath, "demoSection.sav"), SectionSaved);    }
    private void SectionSaved()    {        Debug.Log("SaveSystem: DataSection loaded");    }
}

Declaration#

public virtual void Load(Stream stream, Action onComplete)

Parameters#

NameDescription
streamStrea, to load
onCompleteAction to invoke when load is complete

Description#

Loads full data from a file

Usage#

Example
using NullSave.GDTK;using System.IO;using UnityEngine;
public class CodeSample : MonoBehaviour{
    public void ExampleMethod()    {        // You can create your own DataSections to work with        DataSection target = new DataSection();
        // Data can be loaded directly from a stream        // You can invoke an action when save is complete        using (FileStream fs = new FileStream(Path.Combine(Application.persistentDataPath, "demoSection.sav"), FileMode.Open, FileAccess.Read))        {            target.Save(fs, SectionSaved);        }    }
    private void SectionSaved()    {        Debug.Log("SaveSystem: DataSection loaded");    }
}