Typewriter effect skips prematurely, sometimes

Announcements, support questions, and discussion for the Dialogue System.
JimMakesGames
Posts: 6
Joined: Mon Aug 26, 2024 7:43 am

Typewriter effect skips prematurely, sometimes

Post by JimMakesGames »

I have created several conversations with a Dialogue UI that includes a Typewriter effect for the NPC that is talking. However on some of the lines the typewriter effect will prematurely skip to the end, as if the user has pressed the continue button. It consistently does this for some particular lines and not others. It always skips at the same point, skipping over the last ten or so characters in the line.

I can't tell what is different from one conversation to another. They are all using the same Dialogue UI with the same Typewriter component on the same subtitle. There must a setting I'm not seeing. Any ideas? Thanks!
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter effect skips prematurely, sometimes

Post by Tony Li »

Hi,

I'm guessing the subtitle's Sequence has finished before the typewriter has finished. Please see:
Also maybe related/helpful:
JimMakesGames
Posts: 6
Joined: Mon Aug 26, 2024 7:43 am

Re: Typewriter effect skips prematurely, sometimes

Post by JimMakesGames »

Thanks for the quick reply!

I've read through those and I think I understand. But it seems to me that if I set the Subtitle Chars Per Second in the Dialogue Manager to the same value as the Characters Per Second in the TypeWriterEffect component, shouldn't that make them always sync up? They sometimes do but not always though. What am I missing? I've read the posts you shared several times but I'm afraid I still don't get it.
JimMakesGames
Posts: 6
Joined: Mon Aug 26, 2024 7:43 am

Re: Typewriter effect skips prematurely, sometimes

Post by JimMakesGames »

I currently have the Continue Button setting in the Dialogue System Controller set to Optional which is the behaviour I want. The issue with the skipping of the subtitles goes away if I set it to Always though.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter effect skips prematurely, sometimes

Post by Tony Li »

It should. You may need to temporarily set the Dialogue Manager's Other Settings > Debug Level to Info and trace through the Console logs to see what's going on. More info on that here:



Also check those lines that skip ahead prematurely. If they have something in their Sequence fields that makes their sequences shorter than {{end}}, that could be the issue.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter effect skips prematurely, sometimes

Post by Tony Li »

JimMakesGames wrote: Mon Aug 26, 2024 8:55 am I currently have the Continue Button setting in the Dialogue System Controller set to Optional which is the behaviour I want. The issue with the skipping of the subtitles goes away if I set it to Always though.
Inspect one of the nodes that ends prematurely, and look at its Sequence field. Add this to the beginning of the Sequence field:

Code: Select all

{{default}};
Or:

Code: Select all

Delay({{end}});
The node's current Sequence is probably ending early.
JimMakesGames
Posts: 6
Joined: Mon Aug 26, 2024 7:43 am

Re: Typewriter effect skips prematurely, sometimes

Post by JimMakesGames »

I tried setting the Sequence field of the node to Delay({{end}}); and {{default}}; but neither made a difference.

I've enabled the logging and the two relevant log messages that I get when the dialogue runs are:
Dialogue System: Sequencer.Play( Delay(2.75)@0 )
Dialogue System: Sequencer: Delay(2.75)

The line is 55 characters long, but it skips to the end 11 or 12 characters before the end.

Here's how it looks
npcsubtitle.gif
npcsubtitle.gif (33.45 KiB) Viewed 313 times
JimMakesGames
Posts: 6
Joined: Mon Aug 26, 2024 7:43 am

Re: Typewriter effect skips prematurely, sometimes

Post by JimMakesGames »

I figured it out!

I had set the Delay Typewriter Until Open field in the Standard UI Subtitle Panel to true. So I guess that was causing the typewriter to start at a different time than the subtitle panel became visible, because it was waiting for the animation effect.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typewriter effect skips prematurely, sometimes

Post by Tony Li »

Good catch!

If you want it to be exact, you could identify how long the "show" animation is. For example, if the animation is 0.5 seconds, then you can set the Dialogue Manager's Default Sequence to:

Code: Select all

Delay({{end}})@0.5
This will start the Delay({{end}}) at the 0.5 second mark, which is when the show animation has finished.

Alternatively, you can simply wait for the typewriter to send the "Typed" message, indicating that it's done typing:

Code: Select all

WaitForMessage(Typed)
JimMakesGames
Posts: 6
Joined: Mon Aug 26, 2024 7:43 am

Re: Typewriter effect skips prematurely, sometimes

Post by JimMakesGames »

Ah that's excellent. Thank you for all your help!
Post Reply