Dialogue not showing first line when using Typewriter effect

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Xeraclom14
Posts: 7
Joined: Wed Jan 04, 2023 11:51 am

Dialogue not showing first line when using Typewriter effect

Post by Xeraclom14 »

Hi! I was porting my dialogue system and I'm stuck with what appears to be a simple problem but I've running in circles for hours trying to fix it. I have made my own Dialogue UI from the "Focus" template, and everything works fine, except that when opening a dialogue, the first spoken sentence doesn't show at all.

After a bit of testing, I noticed this is the Typewriter's effect component thats causing this. Simply disabling the effect removes the issue.

I'm using a TMP Text panel and a TMP Typewriter effect component. The TMP text updates correctly, but no characters are shown, and by pressing the Continue button, the conversation continues and all following dialogue works as intended. Any help?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue not showing first line when using Typewriter effect

Post by Tony Li »

Hi,

What Dialogue System version are you using?

Make sure the typewriter effect's Play On Enable checkbox is UNticked
Xeraclom14
Posts: 7
Joined: Wed Jan 04, 2023 11:51 am

Re: Dialogue not showing first line when using Typewriter effect

Post by Xeraclom14 »

I'm on 2.2.33

Play On Enable is unticked, and the issue persists.
Upon some more tinkering, I noticed that the template works fine, even with a TMP typewriter effect on it, so I tried to re-do all my custom Dialogue UI over the template, and when I change the animator/animation controller of DialoguePanel and Subtitle panels is when stuff breaks. Can't find a way to fix it yet
Xeraclom14
Posts: 7
Joined: Wed Jan 04, 2023 11:51 am

Re: Dialogue not showing first line when using Typewriter effect

Post by Xeraclom14 »

Update: I managed to make it work, but only using the original AnimationController "Canvas Group Animation Controller" from the template. When I change it to my own, the first line breaks

Update 2: I found a solution! Turns out, my animation was setting the Textbox's size delta to negative values at the start of the animation, and this broke the typewriter. My solution was to first set the default size for a few frames with canvasGroup alpha set to 0, set the sizeDelta values and then set the alpha back to 1.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue not showing first line when using Typewriter effect

Post by Tony Li »

I'm glad you found a solution!
Xeraclom14
Posts: 7
Joined: Wed Jan 04, 2023 11:51 am

Re: Dialogue not showing first line when using Typewriter effect

Post by Xeraclom14 »

Hi again! I think I found the root of the problem, so if it can be fixed on a future patch here's what's wrong:

The typewriter effect starts regardless if the dialogue panel or subtitle panels are playing their show animation, so if those animations just happens to be on situations where TMP breaks on ForceMeshUpdate() (such as having negative scale / sizeDelta area), it will break for the rest of the animation.

There are two solutions to this scenario:

1) Have the typewriter use ForceMeshUpdate() for the entire duration of the effect.
2) Make it so the typewriter doesn't start until the dialogue panel or subtitle panels stop playing their respective show animations.

Hope this helps!
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue not showing first line when using Typewriter effect

Post by Tony Li »

Hi,

I'll make sure TextMeshProTypewriterEffect calls ForceMeshUpdate() after updating every frame when it updates the visible character count.

For #2, did you tick the subtitle panel's Wait For Open and Delay Typewriter Until Open checkboxes?
Xeraclom14
Posts: 7
Joined: Wed Jan 04, 2023 11:51 am

Re: Dialogue not showing first line when using Typewriter effect

Post by Xeraclom14 »

Somehow I didn't stumble over that option for the entire time I was looking for a solution, oops :lol: maybe it makes more sense to put it in the typewriter itself?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue not showing first line when using Typewriter effect

Post by Tony Li »

The typewriter effect is sometimes also used in other places than subtitle panels, so it's best to keep that checkbox in the subtitle panel.
Post Reply