-1
if(dates == null)
{
    DateTime tempDate = WorldTimeAPI.instance.GetCurrentDateTime();
    print(tempDate);
    dates.SetDailyWeeklyDate(tempDate);
    SaveSystem.TaskDateSave(dates);
}

the error is on third line of the block. The print is printing the date, no issues there.

the SetDailyWeeklyDates() function is below:

public void SetDailyWeeklyDate(DateTime date)
{
    dailyTaskDate = date;
    weeklyTaskDate = date;
}

Thoughts?

thirteen4054
  • 465
  • 4
  • 17

1 Answers1

1

"if(dates == null)" - you only get to the code if dates is null

You either want to change the code to "if(dates != null)" or create an instance of whatever class "dates" is before the third line.

PaulF
  • 6,673
  • 2
  • 18
  • 29