Access to variables (articy draft 3)

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Chrische5
Posts: 6
Joined: Sat Apr 10, 2021 8:52 am

Access to variables (articy draft 3)

Post by Chrische5 »

hello

i have imported my articy project via dialogue system to unity. everthing is perfect. now i want to get access to the varibales. maybe to manipulate them or only read them out. how can i do this?

thanks
chrische
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Access to variables (articy draft 3)

Post by Tony Li »

Hi Chrische,

Variables imported from articy will have names in this format in the dialogue database: group.name

For example, if have a Boolean variable named "DidTheThing" in the group "Globals" in articy, the variable name in the Dialogue System will be "Globals.DidTheThing".

You can read Dialogue System variables in C# using DialogueLua.GetVariable(). Example:

Code: Select all

using PixelCrushers.DialogueSystem; // Add to top of your script.
...
bool didTheThing = DialogueLua.GetVariable("Globals.DidTheThing").asBool;
The variables will also be available in "..." dropdown menus in Dialogue System Trigger components' Run Lua Code action, and also visible in the Dialogue Editor window's Watches section (available at runtime) and Variable Viewer window.
Chrische5
Posts: 6
Joined: Sat Apr 10, 2021 8:52 am

Re: Access to variables (articy draft 3)

Post by Chrische5 »

hello

thx. that was excatly what i was looking for.

chrische
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Access to variables (articy draft 3)

Post by Tony Li »

Glad to help! :-)
Chrische5
Posts: 6
Joined: Sat Apr 10, 2021 8:52 am

Re: Access to variables (articy draft 3)

Post by Chrische5 »

hello

is it also possible to set the variabl with this?

christoph
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Access to variables (articy draft 3)

Post by Tony Li »

Hi,

Yes:

Code: Select all

DialogueLua.SetVariable("Globals.DidTheThing", true);
Chrische5
Posts: 6
Joined: Sat Apr 10, 2021 8:52 am

Re: Access to variables (articy draft 3)

Post by Chrische5 »

hello

sorry, that is embarrassing. thy for your help.

christoph
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Access to variables (articy draft 3)

Post by Tony Li »

No worries! If any questions come up, just ask. I'm here to help.
Post Reply