VN Template - Text wrapping (with text animator)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
c166
Posts: 40
Joined: Fri Oct 14, 2022 11:08 pm

VN Template - Text wrapping (with text animator)

Post by c166 »

Hey Tony,

I am using Dialogue System for Unity + 2.0 Text Animator for Unity (Febucci Tools) and have installed the integration packages along with the third party support packages. I am using a modified version of the TextAnimatorSubtitlePanel (contains some of my own code on top) with the VN template Standard dialogue.

I have a few questions:
  • AutoText Wrapping/ Scrolling
The VN Template Standard dialogue has the Unity UI Scrollbar Enabler, without a scroll rect + content specified. I've taken a look at the scrolling template, but that appears to have a different set-up.

I tried adding a ScrollRect to the Dialogue Panel and then setting the Scroll Content to be the Subtitle text; but it didn't work.
VN_Dialogue_panel.PNG
VN_Dialogue_panel.PNG (39.7 KiB) Viewed 2207 times
The text is going outside the rect/ text box and I'm not sure what I'm missing. Is there a straightforward toggle somewhere so that the text creates a scrolls/ autowraps?
typewriter_text_overflow.PNG
typewriter_text_overflow.PNG (262.93 KiB) Viewed 2207 times
text_exceeding_rect.PNG
text_exceeding_rect.PNG (61.55 KiB) Viewed 2207 times
  • Text Animator Type-writer sound
The dialogue system trigger has an option to pause time while a dialogue is happening.
pause_game_during_convo.PNG
pause_game_during_convo.PNG (32.42 KiB) Viewed 2207 times
The text animator soundwriter plays the sound based on time.
text_animator_sound_by_time.PNG
text_animator_sound_by_time.PNG (30.46 KiB) Viewed 2207 times
That means the dialogue sounds won't play if the dialogue system trigger to pause is activated. Just wondering whether there is an inbuilt solution for this?

I can modify the TAnimSoundWriter to use unscaled time, but am not sure where else I might need to do that - so am wondering if there is already an integrated solution? (to allow time to pause, but not for the text animator components that would affect dialogue)

Happy to do that modification myself, but thought I'd ask (since dialogue system has so many things already solved for, there's been a few where I've built workarounds to then later realise it's already been accounted for)

Edit: Since the change was simple, I've just made it (convert Time.time references to Time.unscaledTime) - am still curious whether there is an inbuilt solution though

Best Regards,
C
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: VN Template - Text wrapping (with text animator)

Post by Tony Li »

Hi,

For the sound, try reaching out to the Text Animator for Unity developer (Febucci) to request him to add an option to play sounds in unscaled time. This way you won't have to constantly reapply your customization whenever you update Text Animator.

(Similarly for the Dialogue System, use C# event hooks or subclasses that override existing virtual methods instead of directly modifying Dialogue System scripts. If you ever find an area that doesn't provide a C# event or virtual method, let me know and I'll add it.)

For the text wrapping:

1. Put your text in a Scroll Rect. See the WRPG Template Standard Dialogue UI for an example.

2. Add a Scrollbar Enabler to the Scroll Rect. Assign it to the subtitle panel's Scrollbar Enabler field.

3. Configure Text Animator typewriter's On Text Started () event to set the Scroll Rect's verticalNormalizedPosition to 0.
c166
Posts: 40
Joined: Fri Oct 14, 2022 11:08 pm

Re: VN Template - Text wrapping (with text animator)

Post by c166 »

Hey Tony,

Thanks for that, it's gotten me a bit closer to the desired result; there's still a few issues though that I haven't been able to work out though. The behaviour that I'm after is just that the latest conversation text appears within the brown text panel (locked to the bounding box that is within that panel) - so that past conversations are scrollable + if the text is too long then it would auto-scroll.

My set-up so far has the subtitle text bounding boxes jump everywhere. Part of it seems to be due to the vertical layout group setting the anchor positions according to the the subtitle text panel, and the menu response panel; even when one or the other is de-activated (the positioning). I have also sent a link to a video via email that might be a bit more clear than these screenshots. Is there an obvious set-up mistake that I've done or toggle that I'm missing?
bounding_box_start_offseted.JPG
bounding_box_start_offseted.JPG (76.29 KiB) Viewed 1399 times
The bounding box also appears to change size with the amount of text. But if the text is larger than the box, it will show nothing in the dialogue pane until it reaches the length where the bounding box overlaps with the scroll rect. The desired behaviour would be that the early text appears in the panel and then is pushed "up" and out of visibility (via autoscroll)
bounding_box_past_anchor.JPG
bounding_box_past_anchor.JPG (33.77 KiB) Viewed 1399 times
The anchors/ bounding box are also moving with the scrolling.
bounding_box_moves_with_scroll.JPG
bounding_box_moves_with_scroll.JPG (91.66 KiB) Viewed 1399 times
bounding_box_moves_with_scroll2.JPG
bounding_box_moves_with_scroll2.JPG (92.95 KiB) Viewed 1399 times
I have also tried setting the scrollRect.verticalNormalizedPosition to the typewriter, but it's not scrolling to the latest text as expected. I tried to set it on each individually, then all together as well.
scrollRect_normalize.JPG
scrollRect_normalize.JPG (38.13 KiB) Viewed 1399 times
Best Regards,
C
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: VN Template - Text wrapping (with text animator)

Post by Tony Li »

Thanks for the details and screenshots. I'll take a look at this in the morning and get back to you.
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: VN Template - Text wrapping (with text animator)

Post by Tony Li »

Hi,

This article has an example scene that has a Scroll Rect that should work the way you want:

How To: Accumulate Text With Multiple Subtitle Panels
Post Reply