Forum rules - please read before posting.

Saving audio source playback's state issue

Hi, I've been having troubles saving a sound playback's state. The sound object is played via Sound: Play with the loop? option set to true. There's no new audio clip. There's just the default audio clip assigned in the inspector. The remember sound component is present.

Manual page 299 (Resources folders)

This must be done for both the original asset and the new one.

Based on the manual, I've put the default audio file asset inside Resources folder. The sound is playing if I leave the scene and then return back into it, but it's never playing after loading a save file.

Does anyone have a similiar issue? If it's working as expected, how do you do it?
AC 1.72 and 1.73

Comments

  • That sounds like the correct workflow. How and when are you saving the game? Via a menu that pauses the game?

  • I have a "SaveInput" menu which pauses the game, though I'm turning the menu off before the actual save. The game should not be paused.

    CloseMenus();
    SaveGame();
    AC.PlayerMenus.GetMenuWithName("Menu").TurnOn();
    
    void SaveGame() {
        AC.SaveSystem.SaveGame(AC.GlobalVariables.GetIntegerValue(0), true, Input.text);
    }
    
  • I can't recreate an issue.

    We'll need to determine if this is specific to your setup. Are you able to reproduce this with the default interface, without the use of custom scripts to handled saving/loading? Try using a new set of Managers in a fresh scene via the New Game Wizard.

  • With a fresh new game with default AC's UI this issue is not present.

  • This is what I see in the save data manager:

  • After some debugging I can see that the game never actually goes into gameplay state before saving.

    I'm not too savvy on that topic, but I suppose the reason is that it's all hapenning in a single frame since it's all handled by a custom script.

    I've changed it to run an action list asset, when the save button is clicked. Not via script, but I set it in the menu manager. The asset turns off the pause save menu and saves the game. But for some reason even when doing it this way it saves the game before switching back into gameplay state and plays the sound.

    Is there a way to unpause the game (switch to gameplay state) via script? How does the default AC's interface do it, that it's in a gameplay state while saving?

  • The game doesn't need to be unpaused in order to save the sound - AC should be able to tell the difference between a sound that isn't playing at all, vs one that isn't playing due to the game being paused.

    The issue of not saving the state correctly while paused may be a duplicate of this issue, which will be addressed in the next release.

    The issue essentially has to do with the Sound object believing the game to be in regular gameplay a frame before it actually is. A temporary workaround may be to delay the call to save for a frame or two. This could optionally be done with an ActionList asset that uses an Engine: Wait Action followed by a Save: Save game Action.

  • Thanks for the information, I'll wait for the update and see if it helps with the issue. If not I'll investigate further.

  • AC 1.73.2 fixed this issue.

  • Great, thanks for the follow-up.

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.