How to find DialogueManager via Script?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Hereder
Posts: 76
Joined: Mon Dec 21, 2020 2:53 am

How to find DialogueManager via Script?

Post 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!
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to find DialogueManager via Script?

Post 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.
Hereder
Posts: 76
Joined: Mon Dec 21, 2020 2:53 am

Re: How to find DialogueManager via Script?

Post 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 .
Hereder
Posts: 76
Joined: Mon Dec 21, 2020 2:53 am

Re: How to find DialogueManager via Script?

Post 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.
Attachments
ViaUI.png
ViaUI.png (189.21 KiB) Viewed 586 times
viaScript.png
viaScript.png (238.86 KiB) Viewed 586 times
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to find DialogueManager via Script?

Post by Tony Li »

Hi,

I just wrote a "How To" article that will help: How To: Set Up Language Selection UI Buttons.
Post Reply