[Bug] Can't deserialize non-mutable items from file if the category has "Item Attributes"

Ignatios

New member
Hey all, I've tracked down my previous issue further with saving/loading items.
This seems to be the main culprit, even after cleaning up corrupted files.

I can repro this issue without fail doing the following:
  1. Make a new item category (doesn't need to have a parent, but it can)
  2. Uncheck Mutable
  3. Add an "Item Attribute" (shown in the attached picture)
  4. Create an Item definition using this new category
  5. Add the item somewhere in your scene
  6. Play the game, grab the item, then save/load
  7. Notice the loading fails, giving you a warning about not being able to deserialize the item.
Resolution:
As long as the category has a "Item Attribute" (in my case, a rarity that I modify), it has to be Mutable.
Maybe this is well-known, but I was trying to track it down for hours and there wasn't any feedback in the console or debug. Perhaps there is a way to add more information to the Warning, stating that it's "a non-mutable item that has mutable attributes"?
 

Attachments

  • Screenshot 2023-08-26 124047.png
    Screenshot 2023-08-26 124047.png
    70.5 KB · Views: 5
Ah, it is as I suspected then. I explained why that is the case in the previous thread:

As for adding a warning in the inspector. It's a good idea. I'll see if there is anything I can add within InventorySaver component to notify about this
 
Gotcha. I guess I just don't understand the main differences between Item Definition Attributes and Item Attributes, so that's my bad, but I figured as long as I didn't change the attribute in the inspector manually, it would stay "as designed" and thus wouldn't need to be serialized specially. I should probably move "rarity" to be a Item Definition Attribute in cases such as this... Thank you!
 
Top