After implementing saving for quest progress (Saveable Quest Progress lecture), I get the quest, save the game, stop the game from playing, then press play again (loading the game), I no longer show the quest progress, and I actually get a weird NullReferenceException with “AttachWeapon()” in the fighter script. I think I had this error a while ago at the end of the inventory course (Null Reference Exception Error) and it’s legit the same error.
It’s actually either not saving ANYTHING or just not loading anything.
The fix that fixed it in the older version of my project doesn’t work for this one (Deleting the old save file)
That’s odd, as AttachWeapon() is in the Fighter script and we shouldn’t be changing that.
As it turns out (and as Sam will point out in the next course), Capturing/Restoring the weapon in Fighter is unneccesary since it’s already being captured/restored in Equipment.
Try removing the ISaveable from the class Declaration in Fighter and see if that helps.
when removing the ISaveable, is it safe to remove the RestoreState & CaptureState?
Yep, they won’t get called anyways.
So getting rid of these states solves the issue of the null reference error, but whenever i load the save file, the weapon thats equipped according to the UI doesnt actually equip on the player character
I fixed the issue after a couple hours of trial and error. hahaha
In Equipment, I called equipmentUpdated(); at the very end of RestoreState.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.