Page 1 of 1

How do I space out subtitles ?

Posted: Fri May 31, 2024 9:01 pm
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.

Re: How do I space out subtitles ?

Posted: Fri May 31, 2024 9:20 pm
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".

Re: How do I space out subtitles ?

Posted: Sat Jun 01, 2024 10:35 am
by Cjazck
Thank you soooo much, it works perfectly !

Re: How do I space out subtitles ?

Posted: Sat Jun 01, 2024 10:42 am
by Tony Li
Glad to help!