Accessing Variables
Once a Dialogue Controller's Dialogue has been initialized, dialogue variables can be accessed outside of dialogue playback by your own scripts.
This provides more control and allows you to retrieve variable values and set variable values for variables which exist within the Dialogue.
Setting Variable Values
To set variable values, you can use the setter methods made available in the Dialogue Controller for each type, string, int, float, and bool:
//Sets the string variable 'myString' to 'Hello'
myDialogueController.SetStringValue("myString", "Hello!");
//Sets the int variable 'myInt' to 42
myDialogueController.SetIntValue("myInt", 42);
//Sets the float variable 'myFloat' to 3.14159
myDialogueController.SetFloatValue("myFloat", 3.14159f);
//Sets the bool variable 'myBool' to true
myDialogueController.SetBoolValue("myBool", true);
Getting Variable Values
Similarly to the setter methods, you can retrieve variable values via the getter methods of the Dialogue Controller for each type, string, int, float, and bool:
//Gets the value of string variable 'myString'
string stringValue = myDialogueController.GetStringValue("myString");
//Gets the value of int variable 'myInt'
int intValue = myDialogueController.GetIntValue("myInt");
//Gets the value of float variable 'myFloat'
float floatValue = myDialogueController.GetFloatValue("myFloat");
//Gets the value of bool variable 'myBool'
bool boolValue = myDialogueController.GetBoolValue("myBool");