Hi
I wanna use Dialogue system as a localization system. So I want to get localized dialogue texts for buttons or other text based UIs in my game.
Can you help me that how can I access the localized conversation texts?
Get localized conversation texts
Re: Get localized conversation texts
I found this way:
But when I use it with void Start, sometimes it gets null and if I put the code on Update, there won't be any problem. So what kind of void do you suggest to use?
Also I'm not sure if it's the best code to get the texts. And I wanted to know that is there any way to access the list of conversations and dialogues as a drop down list from my inspectore?
Code: Select all
public int ConversationID;
public int DialogueID;
void Start () {
GetComponent<RTLTextMeshPro>().text = DialogueManager.MasterDatabase.GetConversation(ConversationID).GetDialogueEntry(DialogueID).currentLocalizedDialogueText;
Debug.Log(DialogueManager.MasterDatabase.GetConversation(ConversationID).GetDialogueEntry(DialogueID).currentLocalizedDialogueText);
}
Also I'm not sure if it's the best code to get the texts. And I wanted to know that is there any way to access the list of conversations and dialogues as a drop down list from my inspectore?
Re: Get localized conversation texts
Hi,
For conversations and quests, use localization inside the Dialogue Database asset.
For UI buttons and labels, use Text Table assets.
Here is the tutorial: Localization Tutorial
Here is the manual page: Localization
For conversations and quests, use localization inside the Dialogue Database asset.
For UI buttons and labels, use Text Table assets.
Here is the tutorial: Localization Tutorial
Here is the manual page: Localization
Re: Get localized conversation texts
Thank you Tony, but I still prefer not to use Text tables. Because using conversation panel is easier.
So just tell me why using void Start gives me null and with void Update, I can get the right variable?
I don't wanna use Update, so I appreciate it if you tell me that what's the best void to use here?
Thanks
So just tell me why using void Start gives me null and with void Update, I can get the right variable?
I don't wanna use Update, so I appreciate it if you tell me that what's the best void to use here?
Thanks
Code: Select all
void Start()
{
GetComponent<RTLTextMeshPro>().text =
DialogueManager.MasterDatabase.GetConversation(ConversationID).GetDialogueEntry(DialogueID).currentLocalizedDialogueText;
}
Re: Get localized conversation texts
Okay. BTW, Text Tables are automatic. Assign the Text Table to the Dialogue Manager, and assign a Localize UI component to the UI element. The Localize UI component will automatically localize the label.
However, if you still want to use the dialogue database, give one frame for the Dialogue Manager's Start to run. For example:
However, if you still want to use the dialogue database, give one frame for the Dialogue Manager's Start to run. For example:
Code: Select all
using System.Collections;
...
IEnumerator Start()
{
yield return new WaitForEndOfFrame();
GetComponent<RTLTextMeshPro>().text = DialogueManager.MasterDatabase.GetConversation(ConversationID).GetDialogueEntry(DialogueID).currentLocalizedDialogueText;
}