Typewriter effect not working

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
njuicetea
Posts: 6
Joined: Thu Feb 01, 2024 8:53 pm

Typewriter effect not working

Post by njuicetea »

Hi there! I'm running into an issue with the typewriter effect- it turns the text invisible but it doesn't unhide the characters at all like it should. Here's a video of my issue:



Sometimes the effect does work, and sometimes it doesn't- I have a feeling it's related to this code I have:

Code: Select all

    private void PrepTxtConvo()
    {
        DialogueManager.displaySettings.conversationOverrideSettings.skipPCSubtitleAfterResponseMenu = true;
        DialogueManager.displaySettings.conversationOverrideSettings.showPCSubtitlesDuringLine = false;
        DialogueManager.displaySettings.conversationOverrideSettings.showNPCSubtitlesDuringLine = false;
        DialogueManager.displaySettings.subtitleSettings.skipPCSubtitleAfterResponseMenu = true;
        DialogueManager.displaySettings.subtitleSettings.showPCSubtitlesDuringLine = false;
        DialogueManager.displaySettings.subtitleSettings.showNPCSubtitlesDuringLine = false;
        DialogueManager.SetDialoguePanel(false, true);
        phoneResponsePanel.gameObject.SetActive(true);
        phoneResponsePanelCanvas.enabled = true;
        DialogueManager.standardDialogueUI.ForceOverrideMenuPanel(phoneResponsePanel);
        DialogueManager.displaySettings.subtitleSettings.continueButton = DisplaySettings.SubtitleSettings.ContinueButtonMode.Always;
    }

    void OnConversationStart(Transform actor)
    {
        string convoName = DialogueManager.LastConversationStarted;
        if (IsTxtConvo(convoName))
        {
            PrepTxtConvo();
        }
        else
        {
            PrepSpokenConvo();
        }
    }

    private void PrepSpokenConvo()
    {
        DialogueManager.displaySettings.conversationOverrideSettings.skipPCSubtitleAfterResponseMenu = false;
        DialogueManager.displaySettings.conversationOverrideSettings.showPCSubtitlesDuringLine = true;
        DialogueManager.displaySettings.conversationOverrideSettings.showNPCSubtitlesDuringLine = true;
        DialogueManager.displaySettings.subtitleSettings.skipPCSubtitleAfterResponseMenu = false;
        DialogueManager.displaySettings.subtitleSettings.showPCSubtitlesDuringLine = true;
        DialogueManager.displaySettings.subtitleSettings.showNPCSubtitlesDuringLine = true;
        DialogueManager.SetDialoguePanel(true, true);
        responsePanel = GameObject.FindObjectOfType<MainCharacter>().gameObject.GetComponentInChildren<StandardUIMenuPanel>();
        DialogueManager.standardDialogueUI.ForceOverrideMenuPanel(responsePanel);
        DialogueManager.displaySettings.subtitleSettings.continueButton = DisplaySettings.SubtitleSettings.ContinueButtonMode.Always;
    }
I realize I'm not using textline or the sms ui that are available, but I've found another approach I prefer, and I'm hoping it's possible to switch between these subtitle settings without causing any other issues, like I suspect it is causing with this typewriter effect.

Any insight is much appreciated, and thank you so much for all your hard work and support for this system <3
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter effect not working

Post by Tony Li »

Hi,

None of the settings in that code should affect the typewriter.

Is the typewriter effect's Play On Enable checkbox ticked? If so, untick it. The subtitle panel will take care of starting the typewriter effect.

If the Dialogue Manager's Other Settings > Dialogue Time has been changed to Gameplay, and if you're setting Unity's time scale to zero (e.g., Time.timeScale=0), this will cause the typewriter to not play since the Gameplay setting means it will observe the paused time scale.
njuicetea
Posts: 6
Joined: Thu Feb 01, 2024 8:53 pm

Re: Typewriter effect not working

Post by njuicetea »

Thanks for the reply! I unticked "Play On Enable" and the issue persists. I also verified that the Dialogue Time Mode is set to Realtime and I'm not altering Unity's time scale at all.
njuicetea
Posts: 6
Joined: Thu Feb 01, 2024 8:53 pm

Re: Typewriter effect not working

Post by njuicetea »

Ok, I fixed it! I was doing something very silly. I was pausing the dialogue in the previous conversation without realizing it would still be paused when starting a new conversation. I do have another question, related to pausing/unpausing. I resorted to pausing/unpausing conversations because I noticed that when I use the subtitle settings below, the continue button mode (which I set to "Always") is ignored and the conversation continues on its own until it reaches a response menu. I thought that might be an expected side effect of hiding the subtitles, but am I missing something? Is there a way to make the Dialogue Manager wait until OnContinue() is called before moving on to the next line?

Code: Select all

DialogueManager.displaySettings.subtitleSettings.skipPCSubtitleAfterResponseMenu = true;
DialogueManager.displaySettings.subtitleSettings.showPCSubtitlesDuringLine = false;
DialogueManager.displaySettings.subtitleSettings.showNPCSubtitlesDuringLine = false;
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter effect not working

Post by Tony Li »

Hi,

No need for all of that. Inspect the Dialogue Manager GameObject and set Display Settings > Subtitle Settings > Continue Button mode to Always. This will wait for the player to click the subtitle panel's continue button (if it has one) or a Continue() sequencer command or calling the dialogue UI's OnContinue[Conversation]().
njuicetea
Posts: 6
Joined: Thu Feb 01, 2024 8:53 pm

Re: Typewriter effect not working

Post by njuicetea »

Thank you! I have verified that the Continue Button mode is "Always". I can reproduce this behavior consistently: when I use those subtitle settings, the conversation continues on its own without waiting for OnContinue(). When I remove those subtitle settings, it waits for my OnContinue() call, as expected. I am using the Basic Standard Dialogue UI, but the actors use their own custom subtitle panels without Continue buttons.
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter effect not working

Post by Tony Li »

I recommend trying to get it working without that extra code. In the long run, it's probably causing more trouble than it's helping. You should be able to make it work properly without any extra code. The conversationOverrideSettings should never be set manually like this.

Inspect the conversation's properties in the Dialogue Editor. (Menu > Conversation Properties) Does it override the Dialogue Manager's settings?
njuicetea
Posts: 6
Joined: Thu Feb 01, 2024 8:53 pm

Re: Typewriter effect not working

Post by njuicetea »

I removed the conversation override settings. They weren't necessary, I only needed the subtitle settings. Are those ok to set manually?
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter effect not working

Post by Tony Li »

Yes, they're okay to set manually, but I still think you don't need to do that. You can set it on the Dialogue Manager. If you want to use different settings for a specific conversation, inspect the conversation's properties in the Dialogue Editor and tick the Override Display Settings checkbox.
Post Reply