Hi.
I have a question about how to use Lua Observer.
In the document, there is only content about variables that I have designated myself as observers.
Like Variable['something'].
Is it possible to use the Lua expression to observe changes across all Variables in the database?
Like how to use an expression like Variable['ALL'].
If there is a way, I want you to give me a guide.
Thank you.
Question about Lua Observer
Re: Question about Lua Observer
Hi,
No, there isn't a way to do that. Lua is like C# in that respect. There's nothing in Unity's C# that will tell you when any variable in all scripts has changed.
You could write C# methods to change Lua variables. Something like:
Then register that method with Lua and use it to set DS variables instead of Variable["foo"] = value.
No, there isn't a way to do that. Lua is like C# in that respect. There's nothing in Unity's C# that will tell you when any variable in all scripts has changed.
You could write C# methods to change Lua variables. Something like:
Code: Select all
public void SetBool(string variableName, bool value)
{
DialogueLua.SetVariable(variableName, value);
Debug.Log($"{variableName} just changed to: {value}"); // Notify me that variable changed.
}