Libgdx JSON saving problem?

Hi guys.

I’m making a game where I have some JSON serializable objects that I can save to a file, and load up at the next time the game is played.

The save structure is like this:

First, an arraylist containing all of the buildings on the map.

A building contains a couple of values unimportant to this issue, and a currentTask variable and an arraylist of tasks (tasks are their own custom class, This is a real-time game, so if you schedule a task and close the game it will technically still be going on.

So upon opening a saved game, it checks to see if any tasks have been completed:

		if(performing && getRemainingTime() <= 0){ //if the facility is performing a task and the remaining the time of the task is <= 0 millseconds
			finishAction(taskScheduled, survivorPerforming); //terminate the current task scheduled
			performing = false; //setting the facility to not performing a task
			startingTime = 0; //reset the starting time of the current task
			endingTime = 0; //reset the ending time of the current task

In the case of this test, the task we are testing is already completed once i open the game. (Keep in mind that if i never close the game, this feature works perfectly fine).

But opening a game with a completed task, all of the tasks within the facility are different, as if they have generated all new ones (ive taken away any code that generates the array of tasks within a facility).

Output of old task vs. new task:


Because of this, finishing the task doesn’t change anything because its not even a variable within the facility anymore. I know this isnt a problem with the saving/loading im doing with JSON because if i start a task, close it, and open it before its completed, the progress is saved and in-tact.

I don’t really know what section of code to post, as this issue seems like it could be a problem with a few different classes and thousands of lines of code, so if you’d like to see something please ask me and ill post it.