When ticking Accumulate Text on a subtitle panel, it's possible that the amount of text can exceed 65000 vertices.
If you switch to TextMesh Pro (see TextMesh Pro Support), you should be able to maintain longer text.
Alternatively, or in addition, you can add a small script to the dialogue UI that lops off old text as you add new text beyond a certain limit. For example, you can add this script to the Dialogue Manager:
LimitSubtitleTextLength.cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class LimitSubtitleTextLength : MonoBehaviour
{
public int maxLines = 50;
private int numLines;
void OnConversationStart(Transform actor)
{
// When we start a conversation, reset the line count.
numLines = 0;
}
void OnConversationLine(Subtitle subtitle)
{
if (string.IsNullOrEmpty(subtitle.formattedText.text)) return;
if (numLines < maxLines)
{
numLines++;
}
else
{
// If we're at the max number of lines, remove the first line from the accumulated text:
var subtitlePanel = DialogueManager.standardDialogueUI.conversationUIElements.defaultNPCSubtitlePanel;
subtitlePanel.accumulatedText = subtitlePanel.accumulatedText.Substring(subtitlePanel.accumulatedText.IndexOf("\n") + 1);
}
}
}
Alternatively, you can use the SMSDialogueUI subclass of the StandardDialogueUI class. SMSDialogueUI adds separate text instances for each line of dialogue. However, when the list of text instances grows large, the subtitle panel's Scroll Rect performance will suffer. To resolve this, you can use the Enhanced Scroller (paid asset) technique included in the Textline example project on the Dialogue System Extras page.