Skip to main content

SaveTarget.LoadMissingObject

Declaration#

public static void LoadMissingObject(Stream stream)

Parameters#

NameDescription
streamStream to use

Description#

Load data for an object saved but not present in scene

Usage#

Example
using NullSave.GDTK;using System.IO;using UnityEngine;using UnityEngine.SceneManagement;
public class CodeSample : MonoBehaviour{
    public void ExampleMethod(string saveId)    {        // Save targest are saved under their own sections, named as below        string section = "__SceneData__" + SceneManager.GetActiveScene().name;
        // Items that don't actually exist in the scene can be recreated from save data        using (MemoryStream ms = new MemoryStream(SaveSystem.GetBinary(section, saveId, new byte[0])))        {            SaveTarget.LoadMissingObject(ms);        }    }
}