Page 1 of 1
How to customize Subtitle Panel?
Posted: Mon Nov 02, 2020 9:47 am
by Housein
I want to Add a text field and a button for every subtitles. they could be shown/hidden by a toggle button in runtime.
Is it possible in Dialogue System?
Standard UI Subtitle Panel component has "Subtitle Text" Field in a wrapper class.
I wonder what is the best way to have and extra Text Field and a Button to subtitles and responds as well.
(I'm not sure if it's the right way to ask these kind of questions here)
Re: How to customize Subtitle Panel?
Posted: Mon Nov 02, 2020 12:32 pm
by Tony Li
Hi,
You can just add them to the subtitle panel and response menu panel. As long as they're a while of the panel, they'll appear when the panel is activated. You can set their values using OnConversationLine and OnConversationResponseMenu methods on the Dialogue Manager. (More info: Script Messages) Example:
Code: Select all
public class ExtraDialogueFields : MonoBehaviour
{
public bool showExtraFields;
public Text extraTextField;
public Button extraButton;
void OnConversationLine(Subtitle subtitle)
{
extraButton.gameObject.SetActive(extraButton);
extraTextField.gameObject.SetActive(showExtraFields);
extraTextField.text = "Subtitle length: " + subtitle.formattedText.text.Length);
}
void OnConversationResponseMenu(Response[] responses)
{
// (Maybe some similar code here)
}
}
Alternatively, you can make a subclass of StandardUISubtitlePanel and StandardUIMenuPanel. Override their ShowSubtitle and ShowResponses methods. If you're using the evaluation version, the base class is in a DLL, but the API references are here: