Hi, I'm trying to modify item attribute's overried value from serialized save data to migrate data from previous version's data. This is my code.
When I debugged my code, 'SetOverrideValue' method executed successfully but an error occurred while executing 'Serialize'. It was stack overflow exception and There is one part that is suspected of causing problems.
I modified Opsive.UltimateInventorySystem.Core.Item class's ItemAttributeCollection property from internal to public to get attributeCollection in my migration code and added uint property 'ItemDefinitionID' to get ItemDefinitionID from saved data. Did these changes cause problems? If not, Is there any way to do what I want to do?
UIS version : 1.2.4
Unity Editor Version : 2020.3.40f1
Error Log :
C#:
if (Opsive.UltimateInventorySystem.SaveSystem.SaveData data.TryGetValue(InventorySystemManagerItemSaveKey, out var itemSaverSerialization))
{
var itemSavedData = (InventorySystemManagerItemSaver.ItemsSaveData)itemSaverSerialization.DeserializeFields(MemberVisibility.All);
var index = Array.FindLastIndex(itemSavedData.Items, x => x.ID == searchingItemID);
itemSavedData.Items[index].ItemAttributeCollection.Deserialize(true);
var attr = itemSavedData.Items[index].GetAttribute<Attribute<T>>(attributeName, false, false);
if (attr != null)
{
attr.SetOverrideValue(callback.Invoke(attr.GetValue()));
itemSavedData.Items[index].ItemAttributeCollection.Serialize();
itemSaverSerialization.Serialize(itemSavedData, true, MemberVisibility.All);
_inventorySaveData.Set(InventorySystemManagerItemSaveKey, itemSaverSerialization);
}
}
When I debugged my code, 'SetOverrideValue' method executed successfully but an error occurred while executing 'Serialize'. It was stack overflow exception and There is one part that is suspected of causing problems.
I modified Opsive.UltimateInventorySystem.Core.Item class's ItemAttributeCollection property from internal to public to get attributeCollection in my migration code and added uint property 'ItemDefinitionID' to get ItemDefinitionID from saved data. Did these changes cause problems? If not, Is there any way to do what I want to do?
UIS version : 1.2.4
Unity Editor Version : 2020.3.40f1
Error Log :