Read updating time and day
Posted: Mon Jun 28, 2021 12:08 pm
Hey, I've tried a couple different methods trying to have the time and date update along with my C# script. I tried both below methods and there is no variable change when observed at runtime.
Code: Select all
public static double minute, hour, day, second, month, year;
public void SendToDialogueSystem()
{
DialogueLua.SetVariable("Second", second);
DialogueLua.SetVariable("Minute", minute);
DialogueLua.SetVariable("Hour", hour);
DialogueLua.SetVariable("Day", day);
DialogueLua.SetVariable("Month", month);
DialogueLua.SetVariable("Year", year);
}
public void HourTracker(double hourUpdate)
{
hour = (double)hourUpdate;
}
public void DayTracker(double dayUpdate)
{
day = (double)dayUpdate;
}
...
void Update()
{
CalculateTime();
CalculateSeason();
SendToDialogueSystem();
}
...
void OnEnable()
{
// Make the functions available to Lua: (Replace these lines with your own.)
Lua.RegisterFunction("HourTracker", this, SymbolExtensions.GetMethodInfo(() => HourTracker(hour)));
Lua.RegisterFunction("DayTracker", this, SymbolExtensions.GetMethodInfo(() => DayTracker(day)));
}
void OnDisable()
{
Lua.UnregisterFunction("HourTracker");
Lua.UnregisterFunction("DayTracker");
}