Page 1 of 1

Switching between databases

Posted: Sat Jan 30, 2016 3:06 pm
by EWalk13
Hi, I am trying to create a game with two language options in it. What my idea was is to have two buttons when the game starts or on the pause menu, one says English and one says Spanish. I want to be able to click the button I want and have it set the Database I am using. For example I have an NPC and when you enter the trigger it will play the english verion, but then I would have a second conversation trigger on it and when the database is the spanish version then it will play the spanish text. Hope you can help!

Re: Switching between databases

Posted: Sat Jan 30, 2016 4:00 pm
by EWalk13
I watched this tutorial https://www.youtube.com/watch?v=lG-k10t3Dz4, but I didn't work for me. I don't need to switch between scenes like in the video. I just want to be in one room and have the buttons switch the database for me. Then when I enter the NPC conversation after I press a button it will play the correct conversation trigger.
This is what I have in my script. Each function is attached to a button's OnClick, and they work when I start with no initial database and select a database to use, but when I try to switch to a new language it doesn't switch.
This is what I have in my script. Each function is attached to a button's OnClick, and they work when I start with no initial database and select a database to use, but when I try to switch to a new language it doesn't switch.
Language.PNG (22.15 KiB) Viewed 785 times

Re: Switching between databases

Posted: Sat Jan 30, 2016 4:10 pm
by EWalk13
Never mind I figured it out. I had to change the order that I was adding and removing items.

Re: Switching between databases

Posted: Sat Jan 30, 2016 9:46 pm
by Tony Li
You don't need two separate databases for language localization. The Dialogue System has built-in localization within the same database.
To switch languages with UI buttons, add an OnClick script that calls DialogueManager.SetLanguage(). For example, change your SetSpanish() method to:

Code: Select all

public void SetSpanish()
{
    DialogueManager.SetLanguage("es"); // Or whatever you use to denote Spanish. ("es" is the .NET convention)
}