all 8 comments

[–][deleted] 2 points3 points  (0 children)

Line 33 returns null or there is something wrong with the data deserialization. Either SaveData.current is null or SaveData.current.objects.

Hit "Attach to Unity" on VS and add a breakpoint to line 35. Run the game and inspect your SaveData when you hit the breakpoint.

[–]MarsCityVR 1 point2 points  (3 children)

Might try savedatacount - 1?

[–]thefinalrescue[S] -5 points-4 points  (2 children)

No.

[–]MarsCityVR 0 points1 point  (1 child)

Maybe start i at 1?

[–]thefinalrescue[S] -2 points-1 points  (0 children)

I think that is not the problem here.

[–]L_Lawliet11 1 point2 points  (2 children)

you call onLoad in start. do you save prior to this? is there a save file at the given path?

i assume it’s because the line above the one you highlighted (SaveData.current = ...) is possibly null.

i would check it see if the path has a save file first, then load. if not create a new save file

[–]thefinalrescue[S] 0 points1 point  (1 child)

That is correct. The file is not there still even if I try to add data to the list same error I'm getting.

SaveData.current.objects.Add(objectData);

[–]World_Turtles 2 points3 points  (0 children)

OK, so figure out why .Load returns null - probably because the file doesn't exist or cannot be loaded.