Forum rules - please read before posting.

Question about Continue From Last Save

Hi,

I just have implemented a "Continue" Button in the Game Menu of my starting scene, and practically, it works well. I simply call the "Save: Save or load" Action" and set it to "Continue From Last Save".

However: When I run my game in Play Mode, the game continues from the correct save game, but when I play from the build, it loads an older save game.

I was wondering if the Play Mode and the Build are keeping track of their own saves at different locations? I did the latest saves in Play Mode, and some older ones while playing the build.

I would have thought that the system just checks the file dates for the newest save game, but this seems not to be the case, although they obviously show the same savegames in the slots where I can load a game manually, so I am a bit confused :wink:

Comments

  • edited September 2020

    Yeah, it's a completely different set of saves and game profiles for the build. The saves for the build are usually under C:\Users\UserName\AppData\LocalLow\DevName\GameName, and the player profiles are in the register under Computer\HKEY_CURRENT_USER\Software\DevName\GameName. As for the editor saves and profiles, you can manage them via the AC tab in Unity.

    I'm not sure why the build would be showing the same save list as the editor though. Are you 100% sure they are the same?

  • edited September 2020

    What platform are you working with, and with which Unity version?

    Save locations and format will vary with platform, but on Windows and Mac, saves are stored within Unity's Application.persistentDataPath folder. The Console will print the exact location when saving and loading.

    AC records the ID of the last save file to be recorded (i.e. the one to continue from) in PlayerPrefs along with the rest of your Profile / Options data.

    IIRC, Editor and builds did save two separate sets of files, but that may no longer be the case with more recent Unity versions.

    To get the best idea of how saving/loading works, try with a fresh set of save files. This can be done either by amending the name of your Save filename in your Settings Manager (which will affect both save files and PlayerPrefs keys), or by deleting your old save file data from the Save-game file Manager.

  • Thank you both.

    I am on Windows 7, using Unity 2019.4.9 and latest AC 1.71.8, building for Windows.

    I just did a little test and deleted all save files from the \AppData\LocalLow\ path, and the list in the game is emtpy in the Editor / Play Mode as well as in the build, so they definitively access the same files.

    Savefile count is still > 0 in both cases, so the buttons that check against that are still visible, I guess because the entries in PlayerPrefs.

    I found a big binary key in the registry at the path Rairun stated, named like the _0-Save file, with a h... suffix, like AC_GameName_0_h6930158, containing 690 Bytes of data.

    I guess that is the PlayerPrefs with all keys stored inside as one large string, as all other keys seem to belong to Unity?

    It looks like the Editor stores the same stuff in HKCU\Software\Unity\UnityEditor\DevName\GameName, so that explains the confusion :smile:

    In my other projects, PlayerPrefs are stored per key, so I have to adapt :smile:

  • edited September 2020

    With that combination, PlayerPrefs will only store the ID of the last save, and the save labels. The SaveFile count should come from the number of save files found - so it should return 0 if the files themselves were deleted.

    Both the save files and the PlayerPrefs rely on the "Save filename", though. When working in the Editor, consider using a variant e.g. "GameName_Editor".

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.