TMP typewriter scroll issue issue

Announcements, support questions, and discussion for the Dialogue System.
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

TMP typewriter scroll issue issue

Post by rykaan »

Hi Tony,

I've run into a problem when switching to using TextMesh Pro for the dialogue panel subtitle text. After switching to TMP + TMP typewriter effect, when the typewriter is stopped due to a continue input, the subtitle box doesn't expand if there are additional lines of dialogue left to be typed. The text simply overflows and is cut off by the panel, without being able to scroll down.
TMP text cut off.jpg
TMP text cut off.jpg (78.17 KiB) Viewed 1893 times
The continue button does correctly end the typewriter effect and the text is fully displayed, but the subtitle text box doesn't expand, so the layout doesn't update the scroll bar etc to accommodate it. Have I simply not properly assigned something or some extra code needed to get this to work like the normal text component? I'll attach some settings images below, hopefully that will reveal whatever mistake I've made in the switch over.
fast forward component.jpg
fast forward component.jpg (43.38 KiB) Viewed 1893 times
trim and typewriter components.jpg
trim and typewriter components.jpg (387.13 KiB) Viewed 1893 times
Cheers,
Rob
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: TMP typewriter scroll issue issue

Post by Tony Li »

Hi Rob,

It looks like Trim And Size Previous Text Subtitle Panel is a custom subclass of StandardUISubtitlePanel. Is this responsible for resizing?

Generally speaking, when the TMPro typewriter stops, it makes sure the TextMeshProUGUI.maxVisibleCharacters property is set to the whole text, and then adjusts the UI element's size. However, I do see one potential issue that may be a bug. Would you please confirm that this fixes it?

Edit TextMeshProTypewriterEffect.cs, and change line 427 from this:

Code: Select all

if (textComponent != null) textComponent.maxVisibleCharacters = textComponent.textInfo.characterCount;
to this:

Code: Select all

if (textComponent != null)
{
    textComponent.maxVisibleCharacters = textComponent.textInfo.characterCount;
    textComponent.ForceMeshUpdate();
}
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

Re: TMP typewriter scroll issue issue

Post by rykaan »

Hi Tony,

Thanks for getting back to me so quickly. That did fix the issue of the text box not resizing correctly! But after the mesh update, the panel doesn't scroll down to the new line correctly, it has to be done manually. Should another line be added after the mesh update to scroll to the bottom? Or would it be better to have that handled in another way?

Cheers,
Rob
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: TMP typewriter scroll issue issue

Post by Tony Li »

Hi Rob,

Hmm, it should jump down to the bottom. Maybe Unity UI isn't updating immediately. Try adding the extra line shown below:

Code: Select all

if (textComponent != null)
{
    textComponent.maxVisibleCharacters = textComponent.textInfo.characterCount;
    textComponent.ForceMeshUpdate();
    Canvas.ForceUpdateCanvases();
}
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

Re: TMP typewriter scroll issue issue

Post by rykaan »

Hey Tony,

That doesn't seem to do it either :S. Rather strange, I can see the literal next line of code calls the method that should prevent this exact issue. There's some juddery behavior too as new lines of text are added that I wasn't getting before changing over to TMP. It look like that's also due to not scrolling down correctly.
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: TMP typewriter scroll issue issue

Post by Tony Li »

I'll try to set up a reproduction project here. If I can reproduce the same issue, I'll provide a solution. Otherwise I may need to ask you for a reproduction project/scene.
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: TMP typewriter scroll issue issue

Post by Tony Li »

Just wanted to add timeline expectations here. It may take me until tomorrow to reproduce the issue and post a resolution, or to ask you for a repro project if I can't reproduce it.
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

Re: TMP typewriter scroll issue issue

Post by rykaan »

Not a problem Tony, thanks for looking into it!
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: TMP typewriter scroll issue issue

Post by Tony Li »

Hi,

I'm not sure how to reproduce this. Would you please send a reproduction project to tony (at) pixelcrushers.com?
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

Re: TMP typewriter scroll issue issue

Post by rykaan »

Hi Tony,

I've sent through the repro-project, hopefully it can shed some light on the issue.

Cheers,
Rob
Post Reply