Forum rules - please read before posting.

ActionList Starter triggering after Loading for current scene AND previous scene

Hi! I'm running into some odd behavior with the ActionList Starter component when Loading save files. When Loading, it appears to trigger the ActionList Starter from the scene I am loading in to as well as the scene I loaded out from.

Here are the repro steps, which should hopefully make things more clear:

  1. Start game in Scene_A (ActionListStarter_SceneA triggers as expected)
  2. Create a new Save file in Scene_A.
  3. Trigger scene transition to Scene_B (ActionListStarter_SceneB triggers as expected)
  4. Load the Save file we created in step #2.
  5. After loading, all actions from ActionListStarter_SceneA trigger (as expected in this scenario, since we are now back in Scene_A), but at the same time ActionListStarter_SceneB triggers.

Here's how the ActionList Starters are set up:

Does anyone have any suggestions? Or are there any known issues about this? I'm unable to update AC at this point due to being in code lock for this game, but I did run a test and upgraded the project to the latest version of AC and this issue didn't seem to be occurring any more (though, there was some unrelated broken behavior in the project after upgrading, so I don't fully trust this test).

AC version: 1.69.5
Unity version: 2019.4.14f1


  • edited November 2020

    I'll attempt a recreation - though your ActionList images aren't showing. Can you re-post to imgur?

    Trying this in a quick test, setting the ActionLists to run "On Load", doesn't cause such an issue on my end, however.

  • Oh, weird, the image was working last night - sorry about that!

    Hmm, perhaps it's another setting specific to our project that's causing that to happen... Is there a way to track down what caused an ActionList Starter to trigger? Or some way to debug to see why it might be doing this?

  • Open up ActionListStarter.cs and insert this at the top of the RunActionLists function around line 197:

    Debug.Log ("Run " + + ", in scene: " + + ", Loading state: " + KickStarter.saveSystem.loadingGame);

    That will print a Console message whenever it is used to trigger an ActionList, as well as which scene it's coming from. Let's see the messages (stacktraces included), that appear in step 5 (those that appear beforehand can be ignored).

  • Huh, that actually produces an error when loading. Here's where I put the debug print, just to be clear:

    It was printing to the console just fine for the the first steps in the repro. Here's the error when loading:

    MissingReferenceException: The object of type 'ActionListStarter' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. UnityEngine.Object.get_name () (at <9674024ab0e74d27bbe9eaa30dab34d1>:0) AC.ActionListStarter.RunActionLists () (at Assets/AdventureCreator/Scripts/Logic/ActionListStarter.cs:197) AC.ActionListStarter.OnAfterChangeScene (AC.LoadingGame loadingGame) (at Assets/AdventureCreator/Scripts/Logic/ActionListStarter.cs:190) AC.EventManager.Call_OnAfterChangeScene (AC.LoadingGame loadingGame) (at Assets/AdventureCreator/Scripts/Managers/EventManager.cs:1445) AC.SaveSystem+<ReturnToGameplay>d__74.MoveNext () (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:1667) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <9674024ab0e74d27bbe9eaa30dab34d1>:0)

  • A bit more info, if I load from the same scene I'm loading in to (in Scene_A and loading a save file created in Scene_A), it works fine and reports this:

    Run PlaySceneAudio, in scene: Pub, Loading state: InSameScene UnityEngine.Debug:Log(Object) AC.ActionListStarter:RunActionLists() (at Assets/AdventureCreator/Scripts/Logic/ActionListStarter.cs:197) AC.ActionListStarter:OnAfterChangeScene(LoadingGame) (at Assets/AdventureCreator/Scripts/Logic/ActionListStarter.cs:190) AC.EventManager:Call_OnAfterChangeScene(LoadingGame) (at Assets/AdventureCreator/Scripts/Managers/EventManager.cs:1445) AC.<ReturnToGameplay>d__74:MoveNext() (at Assets/AdventureCreator/Scripts/Save system/SaveSystem.cs:1667) UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

  • Huh, that actually produces an error when loading.

    That was the clue we needed. It's not unregistering the event.

    In the same script, add the following to the OnDisable function on line 55:

    EventManager.OnAfterChangeScene -= OnAfterChangeScene;
  • Yay, that looks to have fixed it! Thank you very much for the troubleshooting help @ChrisIceBox, I sincerely appreciate the level of support you have for AC and the developers using it - it really makes a difference. I hope you have a fantastic rest of your day! :smile:

    This is the console output now and it's only triggering the single action list for Scene_A:

    Run PlaySceneAudio, in scene: Pub, Loading state: InNewScene

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.