using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using PixelCrushers.DialogueSystem;
public class DayText : MonoBehaviour] {
public Text days;
public string updatedText;
// Update is called once per frame
void Update() {
updatedText = DialogueLua.GetVariable("currentDay").asString;
days.text = updatedText;
}
}
It displays the initial value of the variable but it isn't updating when the value changes.
Too change the value I have in the Script portion of the nodes written
or any other integer but it doesn't update. I've debugged the value on its own to make sure it wasn't the updating the text part that was failing, and it was doing the same only display initial value thing.
You don't have to type it manually; the "..." button will give you dropdowns where you can do it without any typing. It's also super handy for avoiding typos.
(You can skip this if you're not interested in a detailed explanation:)
When you define variables in your dialogue database, at runtime the Dialogue System's Lua stores them in an array named Variable[]. So Variable["currentDay"] corresponds to the variable in your dialogue database. If you run "currentDay = 2", this just sets a new Lua variable not specifically associated with anything in your dialogue database.