[HOWTO] How To: Set Continue Button Label to Continue or End

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Tony Li
Posts: 22093
Joined: Thu Jul 18, 2013 1:27 pm

[HOWTO] How To: Set Continue Button Label to Continue or End

Post by Tony Li »

To change the continue button's label to "End" for the last line in conversations and "Continue" for other lines, add a script like this to the continue button:

SetContinueButtonLabel.cs

Code: Select all

using UnityEngine;
using UnityEngine.UI;
using PixelCrushers.DialogueSystem;

public class SetContinueButtonLabel : MonoBehaviour
{
    void OnEnable()
    {
        if (!DialogueManager.isConversationActive) return;
        var label = GetComponentInChildren<Text>(); // Change Text to TMPro.TextMeshProUGUI if using TextMesh Pro.
        var labelValue = DialogueManager.currentConversationState.hasAnyResponses ? "Continue" : "End";
        label.text = DialogueManager.GetLocalizedText(labelValue); // Localize to current language if available.
    }
}
Post Reply