Page 1 of 2

Adventure Creator/Dialogue UI Scroll Issue

Posted: Tue Mar 26, 2024 7:06 pm
by marafrass
Heya Tony,


Ran into a very specific issue today after the major UI update (and upgrading the Dialogue System to the most recent version) using Adventure Creator today; the dialogue UI is working as intended in pretty much ev

If I trigger two conversations as part of a ActionList cutscene in Adventure Creator, the second conversation doesn't seem to scroll all the way up.

First conversation functioning normally;
Image

Once the first conversation ends, an AC cutscene plays, and the next one is triggered from a specific node. However, the dialogue starts off like this;
Image

I've tried setting the UIScrollbarEnabler to the reset value in Conversation Start, End, Line, UnPause, and Linked Start, but none seem to solve this issue. I've also tried starting conversations from a specific node, but that works fine - I assume it's the sequencing that causes the issue. Before I spend too much time trying to solve this issue, I figured it was worthwhile to check with you to see if anything's changed in this regard in the last few years of updates. (Took me a while to finally update :D ) If there's something simple I've missed, please let me know; if there's a surefire way to make sure that the first line of dialogue always scrolls up, regardless of circumstance, that would solve the issue too!

Re: Adventure Creator/Dialogue UI Scroll Issue

Posted: Tue Mar 26, 2024 9:39 pm
by Tony Li
Hi,

There have been several improvements to UI handling in recent versions. I'll look into this issue and get back to you by tomorrow.

Re: Adventure Creator/Dialogue UI Scroll Issue

Posted: Tue Mar 26, 2024 9:51 pm
by marafrass
Much appreciated!

Re: Adventure Creator/Dialogue UI Scroll Issue

Posted: Wed Mar 27, 2024 12:39 pm
by Tony Li
Hi,

An issue in Dialogue System versions older than 2.2.39 could add a blank line either at the beginning of the conversation or the end. This triggered a TextMesh Pro bug that caused it to compute the text height wrong. In version 2.2.39+, the Dialogue System should no longer add this blank line. Can you check if the subtitle text contains a blank line at the beginning or end of its text? If so, try adding this script to your Dialogue Manager GameObject as a test:

PreventBlankLineAtDialogueStart.cs

Code: Select all

using PixelCrushers.DialogueSystem;
using UnityEngine;

public class PreventBlankLineAtDialogueStart : MonoBehaviour
{
    private void OnConversationLine(Subtitle subtitle)
    {
        subtitle.formattedText.text = RemoveLeadingCRLF(subtitle.formattedText.text);
        DialogueActor dialogueActor;
        var panel = DialogueManager.standardDialogueUI.conversationUIElements.standardSubtitleControls.GetPanel(subtitle, out dialogueActor);
        if (panel != null)
        {
            panel.subtitleText.text = RemoveLeadingCRLF(panel.subtitleText.text);
        }
    }

    private string RemoveLeadingCRLF(string s)
    {
        if (s.StartsWith("\r")) s = s.Substring(1);
        if (s.StartsWith("\n")) s = s.Substring(1);
        return s;
    }
}
If that isn't the issue (i.e., no blank line at beginning or end), is the second conversation's text just off by one line, or is it not scrolling a whole bunch of lines?

Re: Adventure Creator/Dialogue UI Scroll Issue

Posted: Wed Mar 27, 2024 4:36 pm
by marafrass
Doesn't appear to be adding a blank line, as far as I can tell:
Image

I tried adding the script regardless, just to check, but it had no effect.

The text just seems to not scroll up - if you look at the picture, you can see that the line appears where it usually does but it usually scrolls all the way up once the line has been printed. It's essentially placed at the bottom of the scrollbar, when it should be reset to the other end, if that makes sense.

Image

Tried testing this in other circumstances, but the only time this issue occurs right now is when two dialogues follow each other (directly or a few steps after each other) in an AC sequence.

Re: Adventure Creator/Dialogue UI Scroll Issue

Posted: Wed Mar 27, 2024 4:58 pm
by marafrass


Made a quick video showing the difference, in case this helps.

Re: Adventure Creator/Dialogue UI Scroll Issue

Posted: Wed Mar 27, 2024 9:36 pm
by Tony Li
Is it only the first dialogue entry of the second conversation that fails to scroll up?

Re: Adventure Creator/Dialogue UI Scroll Issue

Posted: Wed Mar 27, 2024 10:40 pm
by marafrass
Yes, after the first one everything functions as normal.

EDIT: Did some more testing, and it seems like after triggering multiple dialogues (some from the start and some from specific nodes) in AC sequences, even after regular gameplay in between, there's a chance that the first line won't scroll all the way up. I ran the sequences/cutscenes in the video I linked above twice in a row, and then moved to another NPC which triggers a dialogue almost immediately (which usually works flawlessly), and the same bug appeared. Could it be an issue with the sequencer loading the dialogue UI in and out too quickly or in some way that disrupts it?

Right now it seems like the most foolproof solution would be some way of forcing the first line to scroll regardless of circumstances. Will keep trying other potential fixes.

Re: Adventure Creator/Dialogue UI Scroll Issue

Posted: Thu Mar 28, 2024 8:38 am
by Tony Li
Have you tried ticking the StandardUISubtitlePanel component's Clear Text On Conversation Start (about 1/3 down the inspector) and Clear Text On Close (near the bottom of the inspector)?

Make sure your scroll rect has only one UIScrollbarEnabler component. If your dialogue UI is based off a prefab, it's possible that a UIScrollbarEnabler was added to the prefab after you added your own to your instance.

Also, as a test, add a Dialogue System Events component to your Dialogue Manager and configure OnConversationStart() to call the UIScrollbarEnabler's CheckScrollbarWithResetValue(0) method.

Re: Adventure Creator/Dialogue UI Scroll Issue

Posted: Thu Mar 28, 2024 5:31 pm
by marafrass
Clear Text On Conversation Start (about 1/3 down the inspector) and Clear Text On Close
Had Clear Text On Close set to true, switched both on but it didn't fix the issue.
Make sure your scroll rect has only one UIScrollbarEnabler component. If your dialogue UI is based off a prefab, it's possible that a UIScrollbarEnabler was added to the prefab after you added your own to your instance.
I noticed a number of UIScrollbarEnablers; one on the ScrollRect, one on the Main Panel, and one on the WRPG Template Standard UI (which is the one I've been modifying), all set to affect the ScrollRect, Scroll Content, and Scrollbar. Toggled all except the ScrollRect off, but it didn't solve the issue.
Also, as a test, add a Dialogue System Events component to your Dialogue Manager and configure OnConversationStart() to call the UIScrollbarEnabler's CheckScrollbarWithResetValue(0) method.
I tried doing this on ConversationStart(), ConversationEnd(), ConversationLine(), ConversationLineEnd(), LinkedConversationStart(), and even DialogueSystemUnpause() - that didn't fix the problem either, unfortunately.

I tried tinkering with a few of the other settings and I noticed that if I turn off "Wait For Close" in the Template base, the issue appears at the start of every conversation instead of just sequential ones. Turning "Wait For Main Panel Open" on, however, bugs the conversation out entirely and displays the first line in the top of the ScrollRect while not showing dialogue options or the continue button at all - maybe that gives you some idea of what could be the issue?