Multiple lines Typewriter effect line jumping

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Pgrenon
Posts: 5
Joined: Mon Jan 09, 2023 9:43 am

Multiple lines Typewriter effect line jumping

Post by Pgrenon »

Hi,

When I'm using the Typewriter effect and the text component is vertically centered, the text correctly appears character by character, but for subtitles that would take multiple lines, the text jumps up when a new line is added. The result of this is that while the text is being shown and you are reading it, when the typewriter effect reaches the amount of characters that adds a line to the text box, the text shifts up while the player is reading.

Is it possible to make it so the dialog box contains the final number of lines? That would make it so the height of the text box doesn't increase during the typewriter effect.

I would like to keep my text vertically centered.

I can provide more info if my question isn't clear.

Thanks in advance!
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Multiple lines Typewriter effect line jumping

Post by Tony Li »

Hi,

What typewriter effect are you using? The UnityUITypewriterEffect and TextMeshProTypewriterEffect components will compute the final number of lines / size of the final text and keep it consistent while typing. Are you using some typewriter effect that isn't part of the Dialogue System?
Pgrenon
Posts: 5
Joined: Mon Jan 09, 2023 9:43 am

Re: Multiple lines Typewriter effect line jumping

Post by Pgrenon »

Hi Tony, thanks for your reply, I'm using the TextMeshProTypewriterEffect.

Image
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Multiple lines Typewriter effect line jumping

Post by Tony Li »

Hi,

That looks like a customized version of the script.

However, I can confirm that the original TextMeshProTypewriterEffect script will exhibit this same behavior. Instead of using vertical center alignment, use top alignment, a content size fitter with Vertical set to Preferred, and center it in its parent.

Here's an example of what I mean:

DS_TestTMProVerticalCenter_2023-01-09.unitypackage
Pgrenon
Posts: 5
Joined: Mon Jan 09, 2023 9:43 am

Re: Multiple lines Typewriter effect line jumping

Post by Pgrenon »

Yeah, the modification to the script just plays sounds differently, but doesn't change how the typewriter effect actually controls the text though.

Thanks for the example, I'll cross check our settings with the package you sent!
Pgrenon
Posts: 5
Joined: Mon Jan 09, 2023 9:43 am

Re: Multiple lines Typewriter effect line jumping

Post by Pgrenon »

Hi Tony,

I made a new project in our current Unity version (2021.3.8f1), imported Dialogue System and then imported your package, but the NPC Subtitle Text stays "SubtitleText". See the video:
[media]https://dl.dropboxusercontent.com/s/41d ... XsHrIR.mp4[/media]

EDIT: Ok, I went into Tools > Pixel Crushers > Dialogue System > Tools > Enable TMP and now it works. I'll now try to repro this in our project
Pgrenon
Posts: 5
Joined: Mon Jan 09, 2023 9:43 am

Re: Multiple lines Typewriter effect line jumping

Post by Pgrenon »

Reporting back to say that it looks like it worked. Thanks again!
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: Multiple lines Typewriter effect line jumping

Post by Tony Li »

Glad to help!
Post Reply