Forum rules - please read before posting.

Cannot begin action while changing scene

edited April 2019 in Technical Q&A

I am trying to run an **ActionList **asset across multiple scenes to move a player to another scene and then switch back to the original player and I am getting the following message in console:
Cannot begin Action #8 Engine: Wait in list ActionlistAsset while changing scene, will resume once loading is complete.
What this causes it the actionList getting **stuck ** (in Cutscene) when switching back to the original scene.

I did made a similar actionListAsset that works and goes as follow:
Switch player -> switch scene to original -> switch to original player -> run scene actionList.

The actionList I am having issue with goes like this:
Switch player -> switch to specific scene -> teleport player to marker -> switch back to original player -> run scene actionList.

I am getting the message for the actions following the scene switch action.

While in this topic I also found a bug that causes connections between scene switch actions and the next ones to break (in play mode, being persistent even after stopping play mode).

I have Can survive scene changes? checked.

Unity 2018.2.20f1
AC v1.66.8

Comments

  • The message is showing appropriately - the Action cannot be run during the scene transition.

    I am not clear on your workflow - please provide screenshots of your ActionList chain, and full details on the state of your players (local vs global, where they are are the time, etc), so that I can attempt a recreation.

    While in this topic I also found a bug that causes connections between scene switch actions and the next ones to break (in play mode, being persistent even after stopping play mode).

    I cannot recreate any such issue - please provide steps to recreate the issue.

  • edited April 2019

    Here is a screenshot of the working ActionList asset: https://prnt.sc/ng3c2e
    And a screenshot of the non-working ActionList: prntscr.com/ng3fk9

    I added a 2 sec Wait node after scene switch and it seems to work now, waiting for this long however is not optimal.
    Note that I am still on AC version v1.66.8. Could updating AC solve this?

    I cannot recreate any such issue - please provide steps to recreate the issue.

    I couldn't identify a pattern, that would cause this bug. While in play mode and the scene switch is run, it would sometimes permanently break the connection to the next node. I will try to find a reliable way to recreate this.

  • Forgot to include details regarding player states:
    I am not using any in-scene player prefabs, all players are defined in Settings manager and switched accordingly. I am trying to switching from player A to player B (to a different scene), switching scene with player B and move to a given marker and switching back to player A. All this while camera is faded out.

    The working ActionList asset switches from player A to player B and moves him to the scene (scene switch) player A is in and switches back to player A.

  • edited April 2019

    Thanks for the details, but the placement of scenes/characters is still a little confusing. Is "Peggy" in "CITY_PeggyOffice"?

    If you could annotate both screenshots with information about what scenes are involved (i.e. where each new Player is upon switching, and what Player is in each scene switched to), that'd be great.

    You're using a custom Action to switch Player. Does the issue persist if using the AC default?

    I added a 2 sec Wait node after scene switch and it seems to work now, waiting for this long however is not optimal.

    What was in its place before? No node, or one with a shorter wait time? I'm failing to understand the purpose of switching to the new scene if it's only there for a frame - why not uncheck Restore position? in the Player: Switch Action?

    Note that I am still on AC version v1.66.8. Could updating AC solve this?

    This isn't an issue that's been reported before, so likely not. I do, however, recommend use of "Associated NPC" prefabs to avoid having to assign them manually in the switch Actions.

  • edited April 2019

    Working ActionList with annotations: prntscr.com/ngkvgy
    Non-working ActionList with annotations: prntscr.com/ngkxr8

    Thanks for the details, but the placement of scenes/characters is still a little confusing. Is "Peggy" in "CITY_PeggyOffice"?

    Yes, I made sure the characters were where they are supposed to be. To be clear, character switching works normally.

    You're using a custom Action to switch Player. Does the issue persist if using the AC default?

    I tried using the default action with the same results.

    What was in its place before?

    Nothing was in it's place before. I added it only so that the scene switch completes.

    why not uncheck Restore position?

    The associated NPC object must be removed, so switching to his saved scene is necessary to remove it.

    . I do, however, recommend use of "Associated NPC" prefabs to avoid having to assign them manually in the switch Actions.

    Some player-characters have more than one associated NPC prefab and they have some custom scripts attached so having them referenced in PlayerSwitch actions is necessary.

    I will try find out more about this issue and report back.
    Is there any description/documentation about ActionList assets that are run trough multiple scenes? I failed to find anything about them in the Manual.
    What is the technical background for "Cannot begin X while changing scene, will resume once loading is complete." ? Doesn't the scene switch action continue only after scene switch is complete?

  • edited April 2019

    What is the technical background for "Cannot begin X while changing scene, will resume once loading is complete." ?

    An ActionList won't run while changing scene / repopulating the scene data etc. It's assumed that you'll be in the scene for at least a frame, however.

    Try changing the wait of 2 seconds to -1. Entering a negative number into Engine: Wait will cause a wait of exactly 1 frame.

  • I've added the wait node after Scene switch and it didn't work. The ActionList is still stuck.

    prntscr.com/ngn8w3

    If you check the screenshot you will see that the connection after scene switch broke again. The console messages appeared for nodes 5 and 6, which is odd, since 6 is before scene switch and 5 is the last node.
    Is it possible that some action will never re-run even after the scene is done loading, causing it (the ActionList) to become stuck?

  • edited April 2019

    Following a similar chain of Actions, I cannot recreate such a problem - despite the messages being shown.

    Please be clear about the exact state of things when the error occurs. Keep the ActionList Editor window closed until the issue, and then open it. Which Action is highlighted in green to indicate it's being run? What is the state of the camera, and the characters in the scene?

    You may need to find a way to PM me a cut-down copy of the project/scenes for me to see the issue first-hand.

  • When switched back tho the original scene and when the ActionList is becoming stuck, following states are present:

    • Player is properly switched back to original
    • When reopening ActionList window, no action is highlighted (ActionList asset or in-scene instance)
    • The camera is the same as before

    I created a new, identical ActionList with the same results.

    I did however find out how to trigger the node disconnection. As soon as I inspect (open the editor) the in-scene ActionList instance the connection between Action:SceneSwitch and the next one is broken (in both instance and asset). Doesn't happen if I inspect the asset-based ActionList.

    Hope this helps!

  • I've recreated the node disconnection issue, that'll be addressed in the next update.

    Player is properly switched back to original

    As in, Action #4 in this screenshot?

    Since the Actions aren't highlighting (only consider the scene instance, not the original asset), and since the node disconnects when viewing the ActionList Editor, try enabling comments in the Actions. In Edit mode, go to the asset and toggle on comments for each of the Actions. Write something in each, and then get them to show in the Console via the bottom of the Settings Manager. Which ones get run vs not run?

    Enable the AC Status box at the bottom of the Settings Manager. What does it display once the issue occurs?

    All the same, I think it's looking like you'll have to create a cut-down project for me to see.

  • edited May 2019

    Alright, after some intensive debugging I managed to find the cause of this bug!

    I have added an autosave feature that is triggered after the OnStart cutscene ends (after it ends the player has surely walked in the room, we don't want to save while player is behind a door or something). I found out that when saving, AC calls StopAllCoroutines() (Savesystem.cs, L818), which stops coroutine ReturnToGameplay (L1528), that triggers event OnAfterSceneChange , which is needed for the actionList to continue, since bool isChangingScene in RuntimeActionList.cs depends on the event to be triggered. Removing the autosave fixes it!
    I did stumble upon a cutscene flag Autosave after?, which should works nicely and removes the need for my autosave code. I somehow overlooked it, whoops.

    I've recreated the node disconnection issue, that'll be addressed in the next update.

    Great! Any estimate when the next update will be out? This bug is really annoying and I am concerned it will persist in builds. It would be great if you could provide a temporary fix until the update, if possible. Thanks!

  • Alright, after some intensive debugging I managed to find the cause of this bug!

    Thanks for the info, I'll look into this further.

    Any estimate when the next update will be out?

    As it is a sizeable update, I shall be having a closed beta for it soon. I will PM you at this time.

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.