Forum rules - please read before posting.

Saving/Continuing ActionList Asset's Status After Load/Resume

I have an actionlist asset (not in the scene) that runs over and over in the background as long as the player is carrying a certain inventory item (If you're carrying a cat, an audio "meow" is played from the actionlist every few minutes until you lose the item).

This all works fine, but once the game is quit and resumed, the actionlist doesn't run anymore, despite still carrying the cat.

I figured I could attach a ConstantID to the actionlist but as it's an asset file and not in the scene itself it's not possible. Is there anyway to get this working apart from having to call a check in OnLoad for every scene in the game?

Comments

  • ActionLists won't start automatically upon loading - you will have to manually check the item's presence and then run the correct ActionList if so.

    However, this needn't be performed in each scene's OnLoad cutscene - you can do this from an ActionList asset file and have it run after the loading process regardless of which scene was loaded.

    This can be done by selecting the Load menu's SavesList element and assigning an asset in the ActionList after loading property field.

  • Thanks Chris, but I'm not sure the SaveList menu will work for me in this case as the menu that the game is loaded from simply runs an actionlist that loads up the autosave when the 'Resume' button is clicked.

  • A script can hook into the OnFinishLoading custom event to handle this manually, in that case:

    using UnityEngine;
    using AC;
    
    public class RunActionListOnLoad : MonoBehaviour
    {   
    
        public ActionListAsset actionListOnLoad;
    
        private void OnEnable () { EventManager.OnFinishLoading += OnFinishLoading; }
        private void OnDisable () { EventManager.OnFinishLoading -= OnFinishLoading; }
    
        private void OnFinishLoading ()
        {
            actionListOnLoad.Interact ();
        }
    
    }
    
  • Thanks Chris. I've created the script but not I'm not entirely sure which item I should be attaching this to?

  • Attach it to an object that's in all scenes - your PersistentEngine prefab, Player prefab, or custom EventSystem prefab can all be used.

  • It works perfect, thank you SO much, Chris!

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.