So, I have a scriptable object, which I need to keep track of a date. Because scriptable objects don't keep track of the date between runtime on their own, I came up with the following:
public long EndTimeLong;
private DateTime endTime;
public DateTime EndTime
{
get
{
return endTime;
}
set
{
EndTimeLong = value.ToBinary();
endTime = value;
}
}
So, setting the EndTime to any value, stores it as Binary in EndTimeLong.
Then right before I ever use this at runtime, I call the following method:
public void ReInit()
{
EndTime = DateTime.FromBinary(EndTimeLong);
...
}
So, before I use the scriptable object at all, the original date should be restored.
However, this seems to work find in editor, but it doesn't when in Android.
The way I can tell is that in editor, I run a method which sets endtime to be 60 seconds in the future. I then stop and start the editor playing, and it knows that endtime is in the future still and acts accordingly. (shows some things etc) On android however, it treats it as though the time is not in the future. Why would this behavior be different between the two? And how could I resolve this?