Save System vs WebGL

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Peter Drake
Posts: 37
Joined: Tue May 17, 2022 3:49 pm

Save System vs WebGL

Post 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.
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System vs WebGL

Post 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.
Peter Drake
Posts: 37
Joined: Tue May 17, 2022 3:49 pm

Re: Save System vs WebGL

Post by Peter Drake »

Neat -- I'll have to try that out!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System vs WebGL

Post by Tony Li »

Sounds good! Just set it as described on the Save System page, and change scenes using any of these techniques.
Peter Drake
Posts: 37
Joined: Tue May 17, 2022 3:49 pm

Re: Save System vs WebGL

Post 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."
Peter Drake
Posts: 37
Joined: Tue May 17, 2022 3:49 pm

Re: Save System vs WebGL

Post 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.
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Save System vs WebGL

Post by Tony Li »

Sorry, I forgot you're using TDE. Please see: How To: Use Corgi / TopDown Engine MMSceneLoadingManager
Peter Drake
Posts: 37
Joined: Tue May 17, 2022 3:49 pm

Re: Save System vs WebGL

Post by Peter Drake »

Okay. I have some further questions, but I'll add them over in that other thread.
Post Reply