Page 1 of 1

Save System vs WebGL

Posted: Tue May 17, 2022 11:54 pm
by Peter Drake
It looks like the save system can be used to make information persist between scenes.

Does it depend on access to the file system? I'm making a WebGL game to be posted on itch.io, so that would be a problem.

Re: Save System vs WebGL

Posted: Wed May 18, 2022 7:43 am
by Tony Li
Hi,

It can save in WebGL builds.

The save system consists of three modular parts:
  • Saver scripts: Records states (e.g., GameObjects' positions, enemies' health, etc.) to strings, and restores states from strings.
  • Serializer: Puts the cumulative output of saver scripts in a format that can be saved. The default module serializes to JSON, but you can swap it out with others such as a binary serializer.
  • Storer: Stores serialized data to persistent storage. The default module stores data in PlayerPrefs, which works with WebGL. You can swap it out with others such as a local disk file storer, cloud storer, etc.

Re: Save System vs WebGL

Posted: Wed May 18, 2022 1:05 pm
by Peter Drake
Neat -- I'll have to try that out!

Re: Save System vs WebGL

Posted: Wed May 18, 2022 1:19 pm
by Tony Li
Sounds good! Just set it as described on the Save System page, and change scenes using any of these techniques.

Re: Save System vs WebGL

Posted: Fri May 20, 2022 12:44 pm
by Peter Drake
We're (currently) only saving information between scenes, which looks even easier. According to

https://www.pixelcrushers.com/dialogue_ ... ystem.html

"When changing scenes, the process is the same except the Saved Game Data Storer is not used. The Save System simply holds the save data in memory and applies it to the newly-loaded scene."

Re: Save System vs WebGL

Posted: Fri May 20, 2022 1:13 pm
by Peter Drake
What's the best way to change scenes when using Dialogue System and TopDown Engine?

The DS Save System docs say:
To change scenes, use one of these techniques:

LoadLevel() sequencer command
Scene Portal component attached to a GameObject with a trigger collider.
Add a Save System Methods component. Connect a UnityEvent to SaveSystemMethods.LoadScene.
Or in C# call PixelCrushers.SaveSystem.LoadScene("scene") or LoadScene("scene@spawnpoint");
I've currently got a GameObject with a MoreMountains FinishLevel component attached to it. Should I be replacing this? Adding to it? I'm concerned that TDE may be expecting some things to happen when changing scenes, or that (say) attaching a ScenePortal script to the existing GameObject might cause the new scene to be loaded twice.

Re: Save System vs WebGL

Posted: Fri May 20, 2022 2:20 pm
by Tony Li
Sorry, I forgot you're using TDE. Please see: How To: Use Corgi / TopDown Engine MMSceneLoadingManager

Re: Save System vs WebGL

Posted: Fri May 20, 2022 2:42 pm
by Peter Drake
Okay. I have some further questions, but I'll add them over in that other thread.