Forum rules - please read before posting.

Actionlist (survive scene changes) not saved / loaded

Hi all,

I have an action list with "survive scene changes" that switches scenes after a while (depending if some variables are set.)
This is working fine so far.

If I save the game while this action list is running and load it again, the action list is "lost" and therefore the scene switches are not executed anymore.

The action list is started in a cut scene in another scene. So first time I'm able to "save" the game is in a scene where the action list "survived" a scene change already.

How can I make the actionlist to be stored / loaded with the savegame?

AC Version: v1.73.2
Unity Version: 2020.3.14f1

-
KaiB

Comments

  • Is this for a "background" ActionList, or one that blocks gameplay?

    The running-state of ActionLists are not recorded in save-games because of the unpredictability in restoring their state.

    However, the pause state of ActionList asset is saved - provided that it has been paused before saving, and that the asset itself is set up for saving (see the Manual's "Saving asset references" chapter).

    If you pause the ActionList before saving, you should be able to resume it after loading - both using the ActionList: Pause or resume Action.

    You can run Actions before saving, and after loading, by assigning ActionLists inside the SavesList elements of your Save and Load menus, or by hooking into the OnBeforeSaving / OnFinishLoading custom events.

  • Thank you Chris.
    It is a "background" action list and you provided all info necessary to fix it.
    Works perfect now!

  • How to check if the ActionList Asset is currently paused and needs to resume if you are using addressables?

  • edited June 2023

    What are you using Addressables to reference?

    Please share as much detail as you can about the situation. When Addressables are involved, references are often duplicated so another means may be neceessary.

  • For example, I reference as addressable an ActioList Asset and wanted it to resume after load, but also check, if the particular ActionList Asset was paused.

  • Sorry, but I need more detail - how are you referencing/calling it? Please share screenshots of what's involved.

    The Action: Check running Action is normally used to resume a paused list - are you finding that this isn't working for your list?

    You can normally check if a given asset is running with this function:

    public ActionListAsset myActionListAsset;
    
    public bool IsAssetPaused ()
    {
        foreach (ActiveList activeList in KickStarter.actionListAssetManager.ActiveLists)
        {
            if (!activeList.IsRunning () && activeList.actionListAsset && activeList.actionListAsset == myActionListAsset)
            {
                return true;
            }
        }
        return false;
    }
    

    However, if you're using Addressables - this may not work as Unity can create a duplicate asset that's different to the original one you assign in an Inspector field. In that case, you can try comparing the asset's name:

    public ActionListAsset myActionListAsset;
    
    public bool IsAssetPaused ()
    {
        foreach (ActiveList activeList in KickStarter.actionListAssetManager.ActiveLists)
        {
            if (!activeList.IsRunning () && activeList.actionListAsset && activeList.actionListAsset.name == myActionListAsset.name)
            {
                return true;
            }
        }
        return false;
    }
    
  • Thank you Chris the last example did the trick!

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.