Page 1 of 1
How to find DialogueManager via Script?
Posted: Mon Nov 22, 2021 9:29 am
by Hereder
I want the player to have the choice to change language at any point in the game.
When I drag the Dialogue Manager to my UP "On Click" button and tell it to ->SetLangauge English.
I can see the language changes in the Dialogue Manager object. But when I start playing the game, many strange things happens, I cant hit pause or move..
How can I acces this in Script:
""To use .NET enumerations, use the Localization.GetLanguage() method:
DialogueManager.SetLanguage(Localization.GetLanguage(SystemLanguage.Spanish)); // Use Spanish.""
If I write DialogueManager in my script, its RED lines. As if It cant find it. How do I find it?
Thansk!
Re: How to find DialogueManager via Script?
Posted: Mon Nov 22, 2021 9:33 am
by Tony Li
Hi,
DialogueManager.SetLangugage() is a static method. You don't need to find anything.
DialogueManager is in the PixelCrushers.DialogueSystem namespace. Did you put this line at the top of your script?
Code: Select all
using PixelCrushers.DialogueSystem;
If you did, then it's probably an issue with Unity's Visual Studio plugin (or the plugin for whatever code editor you're using). If so, see
this post to fix it.
Re: How to find DialogueManager via Script?
Posted: Mon Nov 22, 2021 11:31 am
by Hereder
Yeah, if I inser this under "Using Untiy Engine" etc, It shows as error..:
using PixelCrushers.DialogueSystem;
I followed your link and tried both alternetavies but still no good. :S I updated to latest version of Visual Studio. i will look around a bit more .
Re: How to find DialogueManager via Script?
Posted: Thu Nov 25, 2021 12:14 pm
by Hereder
Tony Li wrote: ↑Mon Nov 22, 2021 9:33 am
DialogueManager is in the PixelCrushers.DialogueSystem namespace. Did you put this line at the top of your script?
Code: Select all
using PixelCrushers.DialogueSystem;
Hi again,
So I finally made it work with
Code: Select all
using PixelCrushers.DialogueSystem;
I got error messages first but somehow it works now, not sure why - BUT - I still get some bugs.
If I try to solve it through UI button:
If I place the DialougeManager on my UI button and assign it to -> DialougeSystemController -> SetLangague -> And I write Japanese. It works fine when I start playing the game. "Japanese" will also show up on the DialougeManager Language String field - and it will state "Japanese".
However, if I return back to the start menu from within the game, that UI "On Click" button field will be empty, since the DialougeManager is "tagging along" to the first scene.
So, I have to solve this through Script I suppose. But then another problem occurs.
If I solve it with scripts and start playing the game. "Japanese" will not show up on the DialougeManager Language String field, instead, it will state "ja" - At this point, it doesn't trigger the Japanese Conversations, it default back to english....
Any idea why it shows "Ja" instead of "Japanese" and where does "Ja" come from?
I have two images to show the inspector.
Re: How to find DialogueManager via Script?
Posted: Thu Nov 25, 2021 1:17 pm
by Tony Li
Hi,
I just wrote a "How To" article that will help:
How To: Set Up Language Selection UI Buttons.