Forum rules - please read before posting.

Action List Doesn't any Actions after load request

Adventure Creator is such a joy to use, I just need help getting over this hitch.

First things first, of course: I use Unity 2019.2.15f1 and Adventure Creator 1.69.5.

My load menu displays a confirm window (both Unity GUI prefabs) when the player clicks a save slot,
then loads the save if they click "yes".

This is what the Action List looks like (It's in the confirm window's "yes" button):
https://tinyurl.com/y6v93lo2

I put comments before and after the load, but this is all that shows up on the console:

https://tinyurl.com/yd7vx2te

Sorry about the links. I couldn't get the picture inlays to work.

Has anybody seen a problem like this? I'm sorry if I missed this in the forums.
Thank you very much for listening!

Comments

  • When a save file is loaded, all ActionLists are killed and menus reset to the state they were in when the save was made.

    To do anything custom afterwards (like turn on a Menu), you'll need to place this in a separate ActionList asset file and run it afterwards separately.

    Normally, when loading is performed "automatically" by the SavesList menu element, you can assign an ActionList to run once the file has been loaded. When loading from an Action, however, you don't have that ability.

    What you can do, however, is hook into the OnFinishLoading custom event to run the ActionList asset manually. Here's a script named RunActionListAfterLoading.cs - add it to a new GameObject, assign the ActionList, make it a prefab, and place it in each of your scenes (or mark it as DontDestroyOnLoad to have it survive scene changes):

    using UnityEngine;
    using AC;
    
    public class RunActionListAfterLoading : MonoBehaviour
    {
    
        public ActionListAsset assetToRun;
    
        void OnEnable () { EventManager.OnFinishLoading += OnFinishLoading; }
    
        void OnDisable () { EventManager.OnFinishLoading -= OnFinishLoading; }
    
        void OnFinishLoading ()
        {
            assetToRun.Interact ();
        }
    
    }
    

    Re: images, imgur.com is the easiest, I find. Don't worry about embedding them, links are fine.

  • This works perfectly, thank you!

    I tried making a similar script for saves by copying this and changing "OnFinishLoading" to "OnFinishSaving", but I got this error:

    Severity Code Description Project File Line Suppression State
    Error CS0123 No overload for 'OnFinishSaving' matches delegate

    So, I need to do something differently to make this work on saves, but what?

  • The OnFinishSaving event takes a SaveFile instance as a parameter, i.e.:

    void OnFinishSaving (SaveFile saveFile)
    

    See the Manual's "Save scripting" chapter for a list of all save-related events and their parameters.

  • All right! My project is saved! Thank you!
    Stay safe, everyone!

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.