Page 1 of 1

TDE Integration with persistence across scenes

Posted: Tue Oct 27, 2020 8:01 am
by Ollymuk
Hi

I've been working on saving quests across scenes.

I have it working, though only by either using the Scene portal component of QM or by using a basic script that loads the next scene using SaveSystem.LoadScene. However this results in the quests being kept alive between scenes. Perfect.

However I would prefer to use the TDE scene loader which supports having a loading scene showing whilst the next scene loads. The default QM > DS > TDE integration doesn't seem to enable this and, before I start messing with TDE stuff, I thought I would see whether there is a known way to get quest persistence working with the TDE scene loader?

Olly

Re: TDE Integration with persistence across scenes

Posted: Tue Oct 27, 2020 10:17 am
by Tony Li
Hi Olly,

Two options:

1. Quest Machine has a pretty good scene loader. You can download it here:

PixelCrushers_SaveSystemPrefabs_2020-10-27.unitypackage

The package includes several save system-related prefabs, such as scene portals and checkpoint saves. The included Save System prefab shows how to transition with fade to black and an intermediate loading screen scene.


2. Or, to use TDE's scene loader:
  • Untick the Save System component's Save Current Scene checkbox.
  • If you're using LoadingSceneManager to load a scene on start, make a subclass and override the LoadAsynchronously coroutine. At the beginning of the coroutine, call:

    Code: Select all

    PixelCrushers.SaveSystem.RecordSavedGameData();
    PixelCrushers.SaveSystem.BeforeSceneChange();
    At the end of the coroutine, call:

    Code: Select all

    PixelCrushers.SaveSystem.ApplySavedGameData();
  • If you're calling LoadingSceneManager.LoadScene manually, you'll need to call

    Code: Select all

    PixelCrushers.SaveSystem.RecordSavedGameData();
    PixelCrushers.SaveSystem.BeforeSceneChange();
    before calling LoadingSceneManager.LoadScene. Also add a script that hooks into SceneManager.sceneLoaded. Example:

    Code: Select all

    void Awake() { SceneManager.sceneLoaded += OnLoaded; }
    void OnLoaded(Scene scene, LoadSceneMode mode)
    {
        PixelCrushers.SaveSystem.ApplySavedGameData();
    }