How do I space out subtitles ?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Cjazck
Posts: 2
Joined: Thu May 30, 2024 8:20 pm

How do I space out subtitles ?

Post by Cjazck »

Hi, I'm currently using Articy Draft to write out and organize my dialogue, and then importing it to Unity using the PixelCrushers Dialogue System. I am using "Accumulate Text" to allow my players to check out their dialogue history, but I have come across a problem. Unless I insert a space manually into each dialogue node, the subtitles end up looking like one big paragraph, which messes with readability and scares my playtesters.

In short, if I don't do it manually, my text looks like this:

Entity A - As you wake up from the dream, you find yourself sitting on the ground holding your revolver.
Entity B - Moments before you shot yourself in your dream.

When I would like it to look like this:

Entity A - As you wake up from the dream, you find yourself sitting on the ground holding your revolver.

Entity B - Moments before you shot yourself in your dream.

I've tried inserting the spaces in articy draft but the dialogue system just deletes them.
Is there any way to automate this process ? as it would just save me a lot of time and hassle in general.
Please and thank you in advance.
User avatar
Tony Li
Posts: 21676
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I space out subtitles ?

Post by Tony Li »

Hi,

Add a script to the Dialogue Manager that has an OnConversationLine(Subtitle) method that adds a space:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
public class SeparateSubtitles : MonoBehaviour
{
    void OnConversationLine(Subtitle subtitle)
    {
        if (!string.IsNullOrEmpty(subtitle.formattedText.text))
        {
            subtitle.formattedText.text += "\n\n";
        }
    }
}
If that's too much space, change "\n\n" to "\n".
Cjazck
Posts: 2
Joined: Thu May 30, 2024 8:20 pm

Re: How do I space out subtitles ?

Post by Cjazck »

Thank you soooo much, it works perfectly !
User avatar
Tony Li
Posts: 21676
Joined: Thu Jul 18, 2013 1:27 pm

Re: How do I space out subtitles ?

Post by Tony Li »

Glad to help!
Post Reply