Page 1 of 1

Accumulate Text MaxLines Not Working

Posted: Sat Nov 04, 2023 1:07 am
by boz
So I set maxLines to 35 on the panel and noticed a slowdown eventually. Then I set it to 4 and noticed it was putting in way more lines than 4. I can see that it's cutting off text, but it doesn't seem to be listening to the maxLines that I set.

So I started watching previousText.Length while clicking through dialogue and noticed it just keeps getting bigger and bigger the entire time. Sometimes a little smaller, but always trending towards bigger.

Code: Select all

            if (accumulateText && !string.IsNullOrEmpty(subtitle.formattedText.text))
            {
                if (numAccumulatedLines < maxLines)
                {
                    numAccumulatedLines++;
                }
                else
                {
                    // If we're at the max number of lines, remove the first line from the accumulated text:
                    previousText = previousText.Substring(previousText.IndexOf("\n") + 1);
                    Debug.LogWarning("Previous Text Length: " + previousText.Length);
                }
            }

I tried to make sure there are no scripts overriding this.

What am I missing or what might I check? This is in version 2.2.38.2

Re: Accumulate Text MaxLines Not Working

Posted: Sat Nov 04, 2023 9:45 am
by Tony Li
Hi,

Do your dialogue entries have a lot of line breaks (newlines) in their text? The Max Lines feature uses a heuristic that assumes dialogue entry text doesn't haven't too many line breaks. When it hits max lines, it removes early text up to the first line break.

Re: Accumulate Text MaxLines Not Working

Posted: Mon Nov 06, 2023 9:46 am
by boz
Ah it used to, but I cleaned those up, too.

Would it be happening on every line break? I might have a few between a sentence or something.

Re: Accumulate Text MaxLines Not Working

Posted: Mon Nov 06, 2023 9:57 am
by Tony Li
Hi,

Yes, it's not precise. Say you've set Max Lines to 3. Then you add these dialogue entries:

Code: Select all

A1
A2

Code: Select all

B1
B2

Code: Select all

C1
C2
At this point, the subtitle panel will contain:

Code: Select all

A1
A2
B1
B2
C1
C2
which is already more than 3 "lines," although it's 3 subtitles.

When you then play this subtitle:

Code: Select all

D1
D2
It will remove up to the first line break:

Code: Select all

A2
B1
B2
C1
C2
D1
D2
To address this in 2.2.41, subtitle panels will now observe how many line breaks are in each subtitle, instead of counting each subtitle as a single "line."