Forum rules - please read before posting.

"Continue From Last Save" action, and build stopping

edited July 2021 in Technical Q&A

Hello AC community!

First, some details: Using AC 1.73.8, and Unity 2021.1.7f1, and the menus are made using Unity UI.

Originally I followed this tutorial to create the Main Menu:
https://adventurecreator.org/tutorials/creating-title-screen-menu-1

The Main Menu's layout is fairly straightforward, as seen here:
https://imgur.com/a/V51wQYw
The "Continue" button only appears in the menu when an autosave has been made.

Am having an issue where after building and running the game, the game stops / freezes when clicking "Continue".
What's interesting is that it loads the autosave fine in "Play" mode when clicking "Continue" -- just not in the built game.

The Save: Save or Load -> Continue From Last Save action is run when clicking "Continue" and used to load the autosave.

A screenshot of that only action in the ActionList that runs when clicking "Continue" in the menu:
https://imgur.com/a/XG6oTQQ

Have tried things like deleting all the existing save files, running and letting it autosave again -- though the same stopping / freezing happens when clicking "Continue".

Also tried adding Menu: Change State -> Turn Off Menu to the actionlist shown above. The menu appears to turn off, though the scene doesn't switch to the one which contains the autosave (just stops / freezes on that same scene).

Note: The menu is its own separate scene as it may include animations and other effects in the background eventually (which the second part of the tutorial mentions can be added to the scene).
For this reason, wanted it to appear in its own, separate scene -- as the OnStart cutscenes; and/or the use of Timelines in other scenes could affect that.

Are there any ideas regarding this? Any assistance is greatly appreciated!

Comments

  • edited July 2021

    Hello,

    From further testing -- the Save: Save or Load -> Continue From Last Save action appears to load from the last regular save, rather than the last autosave.

    Given this, it doesn't appear that it addresses the original issue of what was mentioned in the previous post regarding the stopping / freezing. Looking for advice in this area still. It still stops / freezes in the build regardless.

    On another related note, is there another Action that could be called to "Continue from the last autosave" in these specific occasions? Or a way via scripting?

    Thank you again for any assistance that can be provided! It's greatly appreciated!

  • To specifically load the Autoave, set the Action's Method to Load Game, and the Save to load option to Autosave.

    It still stops / freezes in the build regardless.

    Are you referring to loading the last regular save here, or does that work?

    How saving/loading occurs in a build will depend on your target platform. What are you building to?

    To help debugging, enable the AC Status box via the bottom of the Settings Manager. What does that display at the time the issue occurs?

  • edited July 2021

    Thank you!
    Changing The Action's Method to Load Game, and the Save to load option to Autosave works and it loads the autosave in a build (as well as in "Play" mode).

    Are you referring to loading the last regular save here, or does that work?

    No, the regular save didn't work in the built game using Save: Save or Load -> Continue From Last Save action.
    Unsure why that may be as there are other saves (other than the autosave) available to load. The build platform was "PC, Mac & Linux Standalone" and the "Target platform" was "Windows x86".

    As I was actually looking to have the autosave load when clicking "Continue", I don't currently plan to use Continue From Last Save -- so that's not greatly important to solve at the moment. It could be useful to know what causes the stop / freeze in the built game for future reference, though.

    Again, thanks for your assistance with this.

  • We will need to see the contents of the AC Status box at the time the freezing occurs.

    Look for Unity's Player Log file as well - it may reveal more clues towards the bottom if you quit after the freezing.

  • edited July 2021

    Hello there,

    Thanks very much for your assistance!

    When using Save: Save or Load -> Continue From Last Save in the built game, the AC Status box shows "Gameplay is blocked" when clicking the "Continue" button. A screenshot is seen here:
    https://imgur.com/a/Q5z40CJ

    This is with the "Continue" button's actionlist "When Running" field set to: "Pause Gameplay"
    To elaborate more on this, the build doesn't seem like its technically "freezing" since the background music that plays during the Main Menu can still be heard -- the scene just "stops" there. And all of the Main Menus buttons become disabled.

    Understandably from other testing, many Actionlists normally show "Gameplay is blocked" when running, during scene changes, etc.
    Hoping there's some advice that can be supplied in this area.

    For the Player Log file, since all of the Main Menus buttons become disabled (including the "Quit" button), the log contains what outputs appear (near the bottom of the log) when force quitting the game:

    UnloadTime: 1.258000 ms
    PlayerPrefs Key 'AC_GameName_0' loaded

    -> AC debug logger

    PlayerPrefs Key 'AC_GameName_0' saved

    -> AC debug logger

    PlayerPrefs Key 'AC_GameName_0' saved

    -> AC debug logger

    Spawned instance of Player 'Nathan'.

    -> AC debug logger

    Unloading 5 Unused Serialized files (Serialized files now loaded: 0)

    Unloading 20 unused Assets to reduce memory usage. Loaded Objects now: 5850.
    Total: 8.386500 ms (FindLiveObjects: 0.295100 ms CreateObjectMapping: 0.151900 ms MarkObjects: 7.897800 ms DeleteObjects: 0.041100 ms)

    Setting up 6 worker threads for Enlighten.
    Thread -> id: 4c7c -> priority: 1
    Thread -> id: 48c4 -> priority: 1
    Thread -> id: 47f8 -> priority: 1
    Thread -> id: 2e04 -> priority: 1
    Thread -> id: 4440 -> priority: 1
    Thread -> id: 3dd4 -> priority: 1

    Also tried setting the "Continue" button's Actionlist "When Running" field to: "Run in Background" and it again stops at the same point and doesn't load the last save.
    With "Run in Background", there were a couple differences:

    • The game doesn't fully "stop" as it did with "Pause Gameplay" -- the "Continue" button can be clicked, though it doesn't do anything -- it doesn't "Continue from last save". All of the other menu's buttons can be clicked too, and they all work as intended.
    • The AC Status Box shows that the same Actionlist is running, though the "Gameplay is blocked" message doesn't show in the Status box underneath it:
      https://imgur.com/a/IlDniH5

    For the Player Log file with the "Continue" button's actionlist "When Running" field set to: "Run in Background" -- a difference is that the game can be quit using the "Quit" button (since it wasn't disabled like the above "Pause Gameplay" example), and the accompanying Player Log file has one additional line:
    Ended asset MainMenu_ContinueButton_OnClick, but ActiveList data is retained.

    Any further assistance would be greatly appreciated!

  • You should find that - when loading a save-file is sucessful - a Console message appears in the form:

    File read: (Save path/filename)
    

    This should be listed in the Log file for builds as well - as you seeing this appear?

    I suspect the issue is that it has no record of which save to load, which should only be the case if no saves currently exist.

    Open up AC's SaveFileManager script and find the following line:

    EditorGUILayout.LabelField ("ID:", prefsData.ID.ToString ());
    

    Immediately beneath, paste the following:

    EditorGUILayout.LabelField ("Last save ID:", prefsData.lastSaveID.ToString ());
    

    Then go to the Settings Manager and click Manage save-game files to bring up the Save-Game File Manager. What is the "Last save ID" set to, and is that ID used by any of the save-game files listed beneath.

    If unsure, share a screenshot.

  • Thank you for the assistance thus far!

    No, there weren't any lines that read:
    File read: (Save path/filename)

    There are definitely existing save files though.
    Also as mentioned in the original post, it worked to load the last save in "Play" mode, just not the built game.

    The "Last save ID" is "17".
    Yes, the "Last save ID" is used by the last game saved:
    https://imgur.com/a/te71tHm

    Here's a short video showing what happens in the built game with the "Continue" button's actionlist "When Running" field set to: "Pause Gameplay". The menu appears to be entering its disabled state, and the cursor vanishes, etc.

    There also isn't anything in the "Actionlist when turn off" field for the Main Menu.

  • Do you have the Use '_Editor' prefix for Editor save files? option enabled? The saves listed in the Editor/Play mode can differ from those in the Build if so.

    Have you made a new save-game while running the Build before opting to Continue?

    There are definitely existing save files though.

    What platform are you building to? You're seeing these files on the filesystem?

  • edited July 2021

    Thank you!

    No, the Use '_Editor' prefix for Editor save files? wasn't enabled.

    Though making a new save game in the build (and not using the last save from the Editor/Play mode) solved it.

    Never assumed that could be the issue, as loading the autosave worked in both Editor/Play mode as well as the built game (using Load Game -> Save to load -> Autosave as mentioned in a previous post above).

    In any case, it's good to understand what was happening with Continue From Last Save for future knowledge. Thanks again!

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.