Making slight changes to how dialogue displays

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Making slight changes to how dialogue displays

Post by boz »

What would be the best way to go about inserting a carriage return between every line of dialogue so I don't have to remember to manually put one at the start of each dialogue box?

I think once I know that I'd probably be able to start also having it insert the actor/conversant names at the top of paragraph as well? If that's a different matter altogether, can you give me any tips on that as well?

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

Re: Making slight changes to how dialogue displays

Post by Tony Li »

Hi,

You can add a script with an OnConversationLine method to the Dialogue Manager GameObject. Example:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
public class AddLineSpacing : MonoBehaviour
{
    void OnConversationLine(Subtitle subtitle)
    {
        if (!string.IsNullOrEmpty(subtitle.formattedText.text))
        {
            subtitle.formattedText.text += "\n";
        }
    }
}
boz
Posts: 76
Joined: Mon Oct 19, 2020 8:59 pm

Re: Making slight changes to how dialogue displays

Post by boz »

Fantastic, thank you!
User avatar
Tony Li
Posts: 22047
Joined: Thu Jul 18, 2013 1:27 pm

Re: Making slight changes to how dialogue displays

Post by Tony Li »

Glad to help!
Post Reply