Hi Tony,
As the title asks, is there anyway to use the Override Dialogue UI from Timeline?
I'm working on a scene that uses an Aboriginal Australian language in text (the main body of text) and would like to have a second UI window appear with English subtitles. I can use the Alert window for this but the problem is that I have the Alert window centred in the screen and would like the subtitle line to appear below the main body of text.
I could write a script to change the Alerts position every time I require it in this place, but I was wondering if there were an easier way to achieve this effect. Then I saw the override Dialogue UI an thought that maybe that was a solution.
As always, thanks again.
Nathan
Override Dialogue UI from Timeline?
Re: Override Dialogue UI from Timeline?
Hi Nathan,
Interesting question!
You won't need to involve Timeline, other than using it to start the conversation if that's how you're starting it.
The built-in dialogue UI scripts are designed to show text in one language. But the Dialogue System is modular and flexible. It's easy to change this behavior, although it will require a little scripting. Briefly, you'll need to define a subclass of the UnityUIDialogueUI script, and override the ShowSubtitle method to show subtitles (text) in two languages. Then you'd add an Override Dialogue UI component to the conversant, and assign a UI that uses your subclass script. I can put together a basic script tomorrow if you'd like; just let me know.
This is different from what I'm used to seeing in film. In an English film, usually only English translation subtitles appear when characters are speaking a foreign language. Is this perhaps what you want to do instead?
Interesting question!
You won't need to involve Timeline, other than using it to start the conversation if that's how you're starting it.
The built-in dialogue UI scripts are designed to show text in one language. But the Dialogue System is modular and flexible. It's easy to change this behavior, although it will require a little scripting. Briefly, you'll need to define a subclass of the UnityUIDialogueUI script, and override the ShowSubtitle method to show subtitles (text) in two languages. Then you'd add an Override Dialogue UI component to the conversant, and assign a UI that uses your subclass script. I can put together a basic script tomorrow if you'd like; just let me know.
This is different from what I'm used to seeing in film. In an English film, usually only English translation subtitles appear when characters are speaking a foreign language. Is this perhaps what you want to do instead?
Re: Override Dialogue UI from Timeline?
Thanks for the reply, Tony
I'll have a try at this. If I can't figure it out I'll let you know. It's not an urgent task and I'm a little overdrawn of your time this week
The aim with this project is to have the dialogue spoken in the original language and as much of that written in the original language as well. So while, yes, the idea of written Aboriginal language is a Western construct the inclusion of the spoken and the written text helps in the promotion of the language, that's the hope at least.
I'll let you know how it goes.
Thanks again
Nathan
I'll have a try at this. If I can't figure it out I'll let you know. It's not an urgent task and I'm a little overdrawn of your time this week
The aim with this project is to have the dialogue spoken in the original language and as much of that written in the original language as well. So while, yes, the idea of written Aboriginal language is a Western construct the inclusion of the spoken and the written text helps in the promotion of the language, that's the hope at least.
I'll let you know how it goes.
Thanks again
Nathan
Re: Override Dialogue UI from Timeline?
Hi Nathan,
Here's an example scene and script: DualLanguageExample_2018-01-31.unitypackage
You get high school Spanish because I'm afraid I don't know any Aboriginal languages.
The dialogue UI script is just like Unity UI Dialogue UI except it has an additional Translation section at the bottom where you can assign additional UI elements that will show the English translation.
I'll include the script below, too:
DualLanguageDialogueUI .cs
Here's an example scene and script: DualLanguageExample_2018-01-31.unitypackage
You get high school Spanish because I'm afraid I don't know any Aboriginal languages.
The dialogue UI script is just like Unity UI Dialogue UI except it has an additional Translation section at the bottom where you can assign additional UI elements that will show the English translation.
I'll include the script below, too:
DualLanguageDialogueUI .cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
// Shows the NPC's default Dialogue Text in a separate set of UI elements.
public class DualLanguageDialogueUI : UnityUIDialogueUI
{
// Show the default Dialogue Text in these subtitle UI elements:
public UnityUISubtitleControls translation;
public override void Start()
{
base.Start();
translation.Hide();
}
public override void ShowSubtitle(Subtitle subtitle)
{
base.ShowSubtitle(subtitle);
if (subtitle.speakerInfo.IsNPC)
{
// Also show NPC's default Dialogue Text in translation:
subtitle.formattedText = FormattedText.Parse(subtitle.dialogueEntry.DefaultDialogueText, DialogueManager.MasterDatabase.emphasisSettings);
translation.ShowSubtitle(subtitle);
}
}
public override void HideSubtitle(Subtitle subtitle)
{
base.HideSubtitle(subtitle);
if (subtitle.speakerInfo.IsNPC)
{
// Also hide translation:
translation.Hide();
}
}
}
Re: Override Dialogue UI from Timeline?
Tony, Seriously....
Thank you.
Nathan
Thank you.
Nathan
Re: Override Dialogue UI from Timeline?
No worries! Glad to help.