Page 1 of 1
Access to variables (articy draft 3)
Posted: Sat Apr 10, 2021 8:55 am
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
Re: Access to variables (articy draft 3)
Posted: Sat Apr 10, 2021 9:57 am
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.
Re: Access to variables (articy draft 3)
Posted: Sat Apr 10, 2021 10:31 am
by Chrische5
hello
thx. that was excatly what i was looking for.
chrische
Re: Access to variables (articy draft 3)
Posted: Sat Apr 10, 2021 10:38 am
by Tony Li
Glad to help!
Re: Access to variables (articy draft 3)
Posted: Sun Apr 11, 2021 1:57 pm
by Chrische5
hello
is it also possible to set the variabl with this?
christoph
Re: Access to variables (articy draft 3)
Posted: Sun Apr 11, 2021 1:59 pm
by Tony Li
Hi,
Yes:
Code: Select all
DialogueLua.SetVariable("Globals.DidTheThing", true);
Re: Access to variables (articy draft 3)
Posted: Sun Apr 11, 2021 2:33 pm
by Chrische5
hello
sorry, that is embarrassing. thy for your help.
christoph
Re: Access to variables (articy draft 3)
Posted: Sun Apr 11, 2021 3:10 pm
by Tony Li
No worries! If any questions come up, just ask. I'm here to help.