Accessing DS Variable in Script and Displaying in Text issue
Posted: Mon Aug 12, 2024 7:38 am
Hello,
I have a dialogue system number variable called "Money" that I want to display on my UI, however it doesn't update according to what's entered in the inspector.
Would anyone know what I'm missing here?
I have registered 'UpdateMoneyVar()' with Lua in case that helps.
Thank you!
I have a dialogue system number variable called "Money" that I want to display on my UI, however it doesn't update according to what's entered in the inspector.
Would anyone know what I'm missing here?
Code: Select all
using PixelCrushers.DialogueSystem;
public class Money : MonoBehaviour
{
public int moneyAmount;
public TextMeshProUGUI moneyDisplay;
void Update()
{
moneyDisplay.SetText(moneyAmount.ToString());
UpdateMoneyVar();
}
public void UpdateMoneyVar()
{
int moneyAmount = DialogueLua.GetVariable("Money").asInt;
}
Thank you!