Unstable Save/Load.

jimi

Member
Hi there,

Around 30% of players are reporting inventory load issues. When they load back into the game they have missing items or the images and text are for different items. I can not replicate it on any of my machines.

Any ideas?
 
Last edited:
This may be a clue:
Some items in the Grocery category will not load but only if it is obtained from ItemPickUp.cs
Inventory will save/load fine if the same item is obtained from a shop.
This item called Pennyroyal is an example. Attached is also the debug.json file for this save
1622234636604.png
1622234134919.png
 

Attachments

  • SaveFile_002.save.json.txt
    80.3 KB · Views: 3
@Sangemdoko is off for the weekend but we haven't gotten any reports of it. If you can find a way to reproduce it he'll able to take a look.
 
Interesting,

I don't see any particular issue with the save file, perhaps the issue is on save and not on load.

Can you confirm that the issue only happens for Common & Immutable items that are picked up.
The only thing that comes to mind is that the item pickup may have given the item the wrong ID but that shouldn't be happening since the item is registered in Awake.

What script are you using for the pickup, is it an ItemPickup + Item Object or an InventoryPickup + Inventory or something custom?
 
Thanks, Yea. So far I've only found it happening to all the items i've found are Common & Immutable.

I'm using ItemPickup + Item Object. The prefab that spawns the pickup is instantiated at runtime.

TEST1: Pickup via ItemPickup + Item Object.
Before Save
1622470600826.png
After Load
1622470619207.png
Save File
1622470726520.png
 
This is the prefab for the Pickup item and attached save file for that test
1622471314805.png
 

Attachments

  • SaveFile_000.save - TEST1PICKUP.json.txt
    93.3 KB · Views: 0
TEST2: Same Items purchased from shop

Before Save
1622471422403.png

After Load
1622471436786.png
 

Attachments

  • SaveFile_000.save - TEST2Purchase.json.txt
    91.6 KB · Views: 0
It does look like the ID of the carrot in the save file is different from the ID on the prefab. That's fine since the ID of the item on the pickup should change to the correct one when it is spawned. But perhaps there is a bug preventing that.

At runtime, can you confirm whether or not your Item pickup item ID and the Default item ID matches? Since the item is immutable and common there is no reason it should have a different ID.
1622473296490.png

So far I wasn't able to replicate your issue.
Also can you confirm that you are using the latest version of the asset v1.1.7?
 
If I change to Item Definition in the item object on the pickup prefab to any item in a different category save/load is ok.
But, if its changed to a different item in the same Grocery category load fails.
 
Last edited:
Ok! So There is a lingering Item Attribute. Even though it was marked as immutable having the attribute treated it is a mutable on instantiate? Removing the ItemAttribute keeps the id the same as default and just passed a save test.
 
Good catch, I hadn't thought about that.
Immutable items are only immutable after they are registered. Therefore if you change one of the attribute values to a non-default value in the inspector it will create a new item with a different ID when registered. And that's because the default item is not Value Equivalent to the item defined in the inspector.

Most likely I forgot to take into account that edge case when saving items since 99% of the time we use the default item ID for immutable items. I'm assuming that's not what you wanted to do right?

I will add a task to look into supporting saving for non-default immutable items to my TODO list.
 
Sounds good. Thanks for your help here. Was driving me crazy all week.

I actually don't need the non-default immutable. The attribute was just left over from a previous implementation. For this I wasn't changing any attribute values if that helps smooth the edge case.
 
Top