Hi there,
I'm using the Dialogue System Integration with Ink and I've noticed that the code initializes Lua variables that match and observe the global variables in Ink. I notice that if I start with my variables initialized on the Ink side that they don't appear to be read correctly until their first value change from my Ink script.
void OnEnable()
{
textField.text = DialogueLua.GetVariable(variableName).asString; // Receives the value "nil" until first change from Ink.
DialogueManager.AddLuaObserver($"Variable['{variableName}']", LuaWatchFrequency.EveryUpdate, OnChanged);
}
public void InitializeVariables() // Executed after Start Conversation in the DialogueSystemInkTrigger script.
{
// Does not appear to trigger the observer, however this value is definitely available in the Ink script
DialogueSystemInkIntegration.SetInkString(variableName, "Worm");
}
I've inspected things a bit more from this code snippet. It looks like this change doesn't solve the problem for me, and from inspecting the Variable table in the Lua environment, it looks like this is a script execution order issue for me.
At Line 307 in the DialogueSystemIntegration.cs, each of the variables are already correctly initailized in the Lua environment Variable table (I don't know how yet, but they seem to be correct, so the code line that you've suggested appears to be redundant).
Does the Dialogue System have any event to announce that it's finished initialization? I suspect that if I initialize my UI values at the correct time, this will solve my problem.