I want to synchronize a variable that is stored in my GameManager with a variable in the dialogue system (to save it)
I came up with the idea of using the properties
Code: Select all
[SerializeField] [Range(0, 100)] private int _sanity;
public int sanity
{
get
{
_sanity = DialogueLua.GetVariable("Sanity").AsInt;
return _sanity;
}
set
{
_sanity = Mathf.Clamp(value, 0, 100);
DialogueLua.SetVariable("Sanity", _sanity);
}
}
I also wanted to know if there is a way to backsynchronize the variables from the dialogue system
Thanks!