Have text Start on second line

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
StephenC
Posts: 4
Joined: Thu Jun 30, 2022 2:00 pm

Have text Start on second line

Post by StephenC »

I would like to implement something similar to the example I've attached. In this example, the character's name is displayed on line one, then the text begins on line 2.

Currently, in my own project I have "Add Speaker Name" checked in the Standard UI subtitle panel. Below I have the box "Add speaker Name Format" which has the default value of {0}: {1}

I'm wondering if it is possible using this field to tell the system to put the character name on the first line, then on the next line start the dialogue text?

I'm not very good with code, so I'm hoping a solution is possible without needing a custom script. Thanks for any advice!
Attachments
download.jpg
download.jpg (7.97 KiB) Viewed 213 times
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Have text Start on second line

Post by Tony Li »

Hi,

There are two ways to do it:

1. Add the Portrait Name as a separate GameObject. In the screenshot below, I used a Vertical Layout Group:
nameOnTop1.png
nameOnTop1.png (42.44 KiB) Viewed 211 times

2. Or include a new line character in the Add Speaker Name Format, so make it:

{0}\n{1}



The advantage of #1 is that you can style the Portrait Name and Subtitle Text separately.

The advantage of #2 is that it's simpler.
StephenC
Posts: 4
Joined: Thu Jun 30, 2022 2:00 pm

Re: Have text Start on second line

Post by StephenC »

Thank you so much for your quick response. Exactly what I was looking for!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: Have text Start on second line

Post by Tony Li »

Glad to help!
Post Reply