Skip to main content

DataFile.SaveSection

Declaration#

public void SaveSection(string filename, string section, Action onComplete)

Parameters#

NameDescription
filenameFull path of save to load
sectionName of section to save
onCompleteAction to invoke when save is complete

Description#

Saves section to a file

Usage#

Example
using NullSave.GDTK;using System.IO;using UnityEngine;
public class CodeSample : MonoBehaviour{
    public void ExampleMethod()    {        // You can create your own DataFiles to work with        DataFile target = new DataFile();
        // Values in a custom DataFile are never saved/loaded by the system        // They can be saved/loaded manually        target.SetVector3("customSection1", "vector3", new Vector3(1.2f, 3.4f, 5.6f));        target.SetString("customSection1a", "string", gameObject.name);
        // You can save a single section of your data to file        // You can invoke an action when save is completed        target.SaveSection(Path.Combine(Application.persistentDataPath, "demoFile.sav"), "customSection1", DataFileSaveComplete);    }
    private void DataFileSaveComplete()    {        Debug.Log("SaveSystem: DataFile section saved");    }
}