Page 1 of 2

TMP typewriter scroll issue issue

Posted: Mon Dec 06, 2021 7:31 am
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 1758 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 1758 times
trim and typewriter components.jpg
trim and typewriter components.jpg (387.13 KiB) Viewed 1758 times
Cheers,
Rob

Re: TMP typewriter scroll issue issue

Posted: Mon Dec 06, 2021 9:09 am
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();
}

Re: TMP typewriter scroll issue issue

Posted: Mon Dec 06, 2021 9:43 am
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

Re: TMP typewriter scroll issue issue

Posted: Mon Dec 06, 2021 11:06 am
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();
}

Re: TMP typewriter scroll issue issue

Posted: Mon Dec 06, 2021 11:56 am
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.

Re: TMP typewriter scroll issue issue

Posted: Mon Dec 06, 2021 1:15 pm
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.

Re: TMP typewriter scroll issue issue

Posted: Mon Dec 06, 2021 4:37 pm
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.

Re: TMP typewriter scroll issue issue

Posted: Tue Dec 07, 2021 9:03 am
by rykaan
Not a problem Tony, thanks for looking into it!

Re: TMP typewriter scroll issue issue

Posted: Wed Dec 08, 2021 9:54 am
by Tony Li
Hi,

I'm not sure how to reproduce this. Would you please send a reproduction project to tony (at) pixelcrushers.com?

Re: TMP typewriter scroll issue issue

Posted: Wed Dec 08, 2021 1:08 pm
by rykaan
Hi Tony,

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

Cheers,
Rob