Hi there,
This is gonna be hard to explain...
I have two PlayMaker FSMs that continually monitor AC GameState for changes.
The first one goes like this...:
Those actions in green are Interact() methods pointing to 'run in background' Interaction action lists.
Then there's also this one, that checks for GameState.Pause changing...:
That green action also calls for an Interaction that runs in the background. And those 'pause' actions relate to Dialogue System, not AC.
Now, my issue is that if either one of these FSMs is activated AND during a cutscene I press the Menu button to go to the Pause Menu, the game pauses alright, but immediately after it goes into Cutscene mode and then Pause, and then Cutscene, etc., which is a problem because you lose the ability to effectively click 50% of the time.
If no cutscene is running, GameState remains in Pause mode.
I thought at first that one of these FSMs would be responsible for changing GameState value, so I disabled one and then the other in another try, but they BOTH need to be disabled for this not happening. And the only common thing they have is that both of them call an Interact() on running in background Interactions (no cutscene components).
So my reading of this is that if a cutscene is playing when you go to Pause, and then any interaction is run, regardless of its 'run in background' flag, "something" must update the GameState value to Cutscene and then back to Pause, which in my code triggers another Interaction and an infinite loop ensues.
In fact, and to be completely sure that the problem is generated by this condition only, I've disabled these two FSMs and created another one that the only thing it does is watching for a GameState.Cutscene = true condition change (going from true to false and vice-versa) to run, and then calls an "empty" (just a comment action) run in background interaction. This...:
And guess what? It does the same. Infinite pause/cutscene loop.
Weird thing though is that the comment doesn't infinitely prints on the console, as it should...
Has this makes any sense to you? 8-}
I'm going to keep trying modifying my code to try to avoid this loop from happening, but I'm more or less at a loss at why it is occurring in the first place. I mean, this shouldn't happen, right? Those interactions are flagged to run in the background and shouldn't trigger a Cutscene GameState...
I can provide you a video of my testing or any other reference if you want.
Oh, and the point of this working is that I want to allow players to Quit the game even inside a cutscene. I forgot to mention my motivation behind this.
Thank you for your time!
Comments
Normally, AC only goes into Pause mode when a pausing Menu is turned on. If you unchecked Pause game when enabled? in any Menu that gets turned on as part of this, does it then behave?
If you must check AC's GameState, it's better practice to rely on the OnEnterGameState / OnExitGameState custom events, so that you can run code/ActionLists only when the state is explicitly changed, as opposed to having to check it every frame.
More on custom events can be found in the Manual, but to run code whenever e.g. a new state is entered:
private void OnEnable ()
{
EventManager.OnEnterGameState += EnterGameState;
}
private void OnDisable ()
{
EventManager.OnEnterGameState -= EnterGameState;
}
private void EnterGameState (GameState _gameState)
{
Debug.Log ("Entered: " + _gameState);
}
Generally no - though is this ActionList in the scene or an asset file? As there's still an update in between the AC event and the PM FSM though, that could be causing issues.
I'm still not clear on what the core issue is, though. Is it that the UI has a bit gap in between Options and Quit? That can be fixed by introducing layout components to your Unity UI, and having AC disable the Save/Load button gameobjects, as opposed to just hiding them.
Can't say what's to blame at this stage, but now that I've got it on my end I'll look into it and let you know.
Without the added complexity of bringing Dialogue System into play, I've fixed the original issue for the next release.