Page 1 of 1

Dialogue not showing first line when using Typewriter effect

Posted: Wed Jan 04, 2023 12:02 pm
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?

Re: Dialogue not showing first line when using Typewriter effect

Posted: Wed Jan 04, 2023 2:04 pm
by Tony Li
Hi,

What Dialogue System version are you using?

Make sure the typewriter effect's Play On Enable checkbox is UNticked

Re: Dialogue not showing first line when using Typewriter effect

Posted: Wed Jan 04, 2023 2:42 pm
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

Re: Dialogue not showing first line when using Typewriter effect

Posted: Wed Jan 04, 2023 3:13 pm
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.

Re: Dialogue not showing first line when using Typewriter effect

Posted: Wed Jan 04, 2023 4:04 pm
by Tony Li
I'm glad you found a solution!

Re: Dialogue not showing first line when using Typewriter effect

Posted: Thu Jan 05, 2023 3:01 pm
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!

Re: Dialogue not showing first line when using Typewriter effect

Posted: Thu Jan 05, 2023 3:08 pm
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?

Re: Dialogue not showing first line when using Typewriter effect

Posted: Thu Jan 05, 2023 3:22 pm
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?

Re: Dialogue not showing first line when using Typewriter effect

Posted: Thu Jan 05, 2023 3:28 pm
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.