a space between each line of dialogue?

Announcements, support questions, and discussion for the Dialogue System.
ar4wy
Posts: 26
Joined: Fri Nov 15, 2019 10:16 pm

a space between each line of dialogue?

Post by ar4wy »

Hi Pixel Crushers!

I'm new to the asset and I'm trying to figure out something seemingly simple!

Right now, my dialogue looks like this:

-----
ACTOR1: hello something something something
ACTOR2: hello to you too
ACTOR1: nice
-----

How can I make it look like this?

-----
ACTOR1: hello something something something

ACTOR2: hello to you too

ACTOR1: nice
-----

So that there is a break between each character's line of dialogue. I've tried to change line spacing, but it changes all text. Is this is something in the Dialogue panel (modifying the database?) Is there something I can do to format what is being sent to the text component and being shown?

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

Re: a space between each line of dialogue?

Post by Tony Li »

Hi,

Thanks for using the Dialogue System!

You can give the Dialogue Manager a small script with an OnConversationLine method, such as:

DoubleSpaceSubtitles.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class DoubleSpaceSubtitles : MonoBehaviour
{
    void OnConversationLine(Subtitle subtitle)
    {
        subtitle.formattedText.text += "\n";
    }
}
This script adds a blank line at the end of every subtitle before it's send to the dialogue UI for display.
ar4wy
Posts: 26
Joined: Fri Nov 15, 2019 10:16 pm

Re: a space between each line of dialogue?

Post by ar4wy »

Thank you! Works great!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: a space between each line of dialogue?

Post by Tony Li »

Glad to help!
Olafs Osh
Posts: 13
Joined: Tue Feb 19, 2019 8:12 am

Re: a space between each line of dialogue?

Post by Olafs Osh »

Resurrecting this not-so-old-actually thread.

I understand, that "/n" adds an extra line. But how to modify spacing between the lines more precisely. I would need just a tad, so larger blocks of text are better readable.

- Olafs
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: a space between each line of dialogue?

Post by Tony Li »

Try "<br>" instead of "\n". I think that does a paragraph break in TextMesh Pro (although it's a line break in standard HTML). Then you should be able to set the paragraph spacing amount in your TextMeshProUGUI.

If that doesn't work, then instead of "\n" you could try a line break with a smaller font size: "<size=50%><br><size=100%>"
Olafs Osh
Posts: 13
Joined: Tue Feb 19, 2019 8:12 am

Re: a space between each line of dialogue?

Post by Olafs Osh »

Heh. Upon running the thing, it writes Subtitle properly and then switches to this oddly looking stuff:
[img] - ds01.jpg


Just "<br>" goes like this..
[img] - Screenshot_20.jpg


The winner is "\n", but, yep, it's too much...
[img] - Screenshot_21.jpg
Attachments
Screenshot_21.jpg
Screenshot_21.jpg (15.22 KiB) Viewed 1173 times
Screenshot_20.jpg
Screenshot_20.jpg (8.33 KiB) Viewed 1173 times
ds01.jpg
ds01.jpg (24.71 KiB) Viewed 1173 times
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: a space between each line of dialogue?

Post by Tony Li »

Are you using TextMesh Pro? Make sure your TextMeshProUGUI allows rich text tags.
Olafs Osh
Posts: 13
Joined: Tue Feb 19, 2019 8:12 am

Re: a space between each line of dialogue?

Post by Olafs Osh »

Kinda...
Screenshot_22.jpg
Screenshot_22.jpg (84.57 KiB) Viewed 1161 times
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: a space between each line of dialogue?

Post by Tony Li »

Maybe, instead of the extra rich text tags, it would be sufficient to use only "\n" as before but increase the TextMeshProUGUI's Spacing Options > Line value.
Post Reply