Forum rules - please read before posting.

Speech UI Stuck On Screen After Scene Loading

Hi,

I have been trying to solve this problem for a long time. But I couldn't find a solution. In scene changes, I run Dialogue: Stop Speech before Engine: Change Scene. I've tried finding and Destroying the GameObject on scene changes but that doesn't work either.

AC: 1.73.0
Unity: 2020.1.2f1

This is the video;

https://drive.google.com/drive/folders/1jD4JtC8p_-1aGxeAZ7O_2MgIhyzSJ5mY?usp=sharing

Comments

  • The speech bubble appears to transition in once the new scene has loaded - it's not there in the first frame of the new scene.

    As your "Transition type" is set to "None", how is it fading in/out? Through a custom script? Try disabling any custom scripts associated with the prefab - does that make a difference?

  • I do not have any transition script on it. I create a Global Bool Var and set it to false. Then when Loading Menu TurnOn add an action list on it and set Global Bool Var to true and for the Menu TurnOff either to set Global Bool var to False. Then Create a small script:

    bool isLoading;
    int loadingGlobalVar;

    void Update()
    {
    isLoading = GlobalVariables.GetBooleanValue(loadingGlobalVar);
    if (isLoading) Destroy(gameObject);
    }

  • On what object are you adding the script? If this is an attempt to workaround the original issue, leave it off the prefab for the moment so that we can work with AC's original behaviour.

    The menu is visibly fading in and out in the video. If it's not automated through the Menu's "Transition type", I can't see how else it might be doing so.

    Here's a script that may help us learn what's going on. Add it to an empty in the second scene of your video and repeat the process in the video:

    using UnityEngine;
    using AC;
    
    public class MenuEventTest : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnMenuTurnOn += OnMenuTurnOn; }
        private void OnDisable () { EventManager.OnMenuTurnOn -= OnMenuTurnOn; }
    
        private void OnMenuTurnOn (AC.Menu menu, bool isInstant)
        {
            if (menu.title == "Subtitles")
            {
                if (menu.speech != null) Debug.Log ("Subtitle menu on for: " + menu.speech.FullText + ", Alive? " + menu.speech.isAlive);
                else Debug.Log ("Subtitle menu on for no speech");
            }
        }
    
    }
    

    You should then get messages in the Console whenever the Subtitles menu is turned on, detailing the Speech it is displaying. What message(s) appear at the moment the issue occurs when entering the second scene?

  • edited June 2021

    " The menu is visibly fading in and out in the video. If it's not automated through the Menu's "Transition type", I can't see how else it might be doing so. "

    It was Canvas Group Fade, which I used as Transition Type while you were watching it in the video. For testing purposes, I turned off the transition type to see if the problem was because of this or something else. There has been a misunderstanding here. I am not using any code for Transition.

    I added the code to the second scene in the video as you said. But when I faced the same problem, I did not encounter any feedback in console.

    This is the scene where subtitle is stuck on screen and you can see there is no console feedback:

    But the dialogue stuck on the screen is set like this.

    Maybe it can help I don't know.

  • Thanks for clarifying.

    Here's a more simple script that you can attach to the prefab's root Canvas:

    using UnityEngine;
    
    public class EnableTest : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            Debug.Log ("ENABLE " + this, this);
        }
    
    }
    

    This should cause a Console message at the same time I'd hoped earlier. Try again, and if/when a message appears in the second scene, copy/paste the message in full (stacktrace included).

  • edited June 2021

    First scene: During my tests, I noticed that it gives 3 feedbacks for a single dialog. It gives instant to the first two. But he gives the third at the time of closing the dialogue.

    The first one is ENABLE SubtitlesUI(Clone) (EnableTest)

    See Full stacktrace.

    Second place is ENABLE SubtitlesUI (EnableTest)

    See Full stacktrace.

    Third place is ENABLE SubtitlesUI (EnableTest)

    See Full stacktrace.

    When I change the scene after the first two dialogues that take place in the first scene.
    There were 6 feedbacks from the two dialogs in the Console. I got two pieces of feedback from the dialogue stuck on the scene.

    The first one is ENABLE SubtitlesUI(Clone) (EnableTest)

    See Full stacktrace.

    Second place is ENABLE SubtitlesUI (EnableTest)

    See Full stacktrace.

    I have to give important information for better understanding. To face this problem, the scene change needs to be done at a specific time. It's not always the case.

  • To face this problem, the scene change needs to be done at a specific time.

    And what is this specific time?

    The stacktraces in the second scene suggest the menu is being turned on as a result of speech being triggered. While we get to the bottom of this, make sure there are no ActionLists set to begin in the new scene.

    Are any of the ActionLists running at the time of the scene change coming from asset files that are set to survive scene changes?

    Enable the AC Status box via the bottom of the Settings Manager. Does it list any ActionLists running once the new scene is switched to?

    We can try to find out what speech is being triggered. Open up ActionSpeech.cs, and find the line beginning:

    speech = KickStarter.dialog.StartDialog ...
    

    Immediately above it, paste the following:

    LogWarning ("Playing speech: " + _text);
    

    That will then produce a warning message in the Console each time a new speech is triggered. If you click on it, it should also reveal which ActionList it came from. What are the details of any such messages in the new scene, at the time the issue occurs?

  • And what is this specific time?

    It happens on the thin slice of time when we change a level and a subtitle text is being generated at that precise moment.If the scene change occurs just at the time of the generation of a speech bubble this error happens.

    Are any of the ActionLists running at the time of the scene change coming from asset files that are set to survive scene changes?

    To play the sound when I changed the Source to Adventure Creator, I defined an Action Asset List to run when the Menu is closed. Other than that, I don't use any Action Asset List.

    Source : Adventure Creator Test

    I was thinking that the source of the problem was Unity UI. I decided to use Adventure Creator as the source. I created the exact same speech in the game using the AC UI. I use two dialogs in the game. There are two versions, Common and Obligatory. If the dialog is Obligatory, I created a TurnOff Action Asset List to play a sound effect when the menu is closed.

    Obligatory Dialogue

    Display subtitle forever
    Subtitle can be skipped
    Can skipt with mouse

    Common Dialogue

    Do not display subtitle forever
    Subtitle can not be skipped
    Can not skip with mouse

    And I create a script to control this states.

    See Full script.

    This is the Menu settings:

    This is the Subtitles_TurnOff:

    But, this tests does not fix this problem. Still the Subtitles is stuck on screen.

    Add LogWarning to ActionSpeech.cs Tests

    I turn back to Source: Unity UI prefab and past your script to ActionSpeech.cs.
    This is the feedback coming from Console.

    Playing speech: Have you heard about how he died?
    (From Action #3 in ActionList 'RightDialogue')

    See Full stactrace.

    On the second scene I have OnStart Cutscene I delete it and try to reproduce this problem and again its still stuck on the screen.

    Playing speech: Have you heard about how he died?
    (From Action #3 in ActionList 'RightDialogue')

    See Full stactrace.

  • Please leave any and all custom scripts out of this for the moment. We first need to know if this is an issue with AC by itself - avoid running your custom Action temporarily.

    The logs mention a speech with the next "Have you heard about how he died?". In which scene is this present, and how is it run in relation to the speech shown in the video?

    If the issue occurs without the presence of custom code, and an AC menu, you should be able to PM me a .unitypackage of the two scene files and your Manager assets. If you can also give instructions on how to get the issue to occur, I'll see if I can recreate it myself.

  • The logs mention a speech with the next "Have you heard about how he died?". In which scene is this present, and how is it run in relation to the speech shown in the video?

    Scene 1: There is a trigger next to the NPCs. The Trigger works as Run In Background. If it hits the Dialogue Action just before changing the scene, it renders the UI Canvas and gets stuck in the other scene.

    Scene 2: There is an On Start Action. There are Actions that control the Timeline and the direction the Character is looking at.

    Solution

    I'm speaking in terms of guesses. There is an ActionList running in the background on the stage and if the ActionList is not finished, it creates a problem in scene switching.

    Solution: I killed all of the ActionLists running in the Background to the Scene Changing ActionListi with ActionList:Kill Action. Before Scene:Switch Action, I set Engine:Wait to 0.1 and never faced this problem again. If there is a negative progress, I will bring an update here.

    Thanks for your quick response Chris.

  • KouKou
    edited December 2023

    So, i ran into the exact same problem and almost gave up, since the "killing all other action lists" wasn't an option for me. But, i found a workaround, that i wanted to share:

    In the Menu-Manager go to the Subtitles Menu that is causing problems and uncheck the "duplicate for each line?" option!

    I don't know yet, what that option is good for and why it is checked by default -it will have it's reasons - but eversince I unchecked it I didn't get that bug again!

    (Probably because it is "reusing" the buggy speechbox for an other dialogue and just about all of my scenes start with dialogue right away)

  • The "Dupliate for each line?" option causes each displayed speech line to rely on its on copy of the Subtitles menu. This allows for multiple characters to be seen speaking at once - unchecked, only the last-spoken speech will be displayed.

    If you find you want to have this checked, create a new thread with details of your AC/Unity versions and steps to recreate, and we can look into solving the issue.

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.