Page 1 of 1

Line Break with Ink

Posted: Thu Feb 27, 2020 8:37 am
by Sharzia
Hello,

I have the same issue described in this topic but with Ink instead: https://www.pixelcrushers.com/phpbb/vie ... eak#p15121

I tried the same things but I had no luck. I can't go to next the paragraph, it's all in a big wall of text :/
If anyone knows how to fix this, I thank you in advance :/

Re: Line Break with Ink

Posted: Thu Feb 27, 2020 8:57 am
by Tony Li
Hi,

Ink is a different beast from all of the other authoring tool integrations. With Ink, the Dialogue System acts as a front-end for Ink's back-end engine. It just displays whatever it receives from Ink.

However, you can still process the text after receiving it from Ink but before it's shown onscreen. Add a script like this to your Dialogue Manager:

ConvertNewlines.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class ConvertNewlines : MonoBehaviour
{
    void OnConversationLine(Subtitle subtitle)
    {
        subtitle.formattedText.text = subtitle.formattedText.text.Replace("\\n", "\n");
    }
}
This will replace any occurrences of the character string "\n" with a line break. If you prefer specifying line breaks with "<br>", change the line to:

Code: Select all

        subtitle.formattedText.text = subtitle.formattedText.text.Replace("br>", "\n");

Re: Line Break with Ink

Posted: Thu Feb 27, 2020 9:23 am
by Sharzia
it worked :D
Thank you, It was such a headache for me :x

Re: Line Break with Ink

Posted: Thu Feb 27, 2020 10:20 am
by Tony Li
Glad it's working, and happy to help.