Error, Item's override value gets defaulted back to the inherited value on

Bernkastel

Member
I have an InventoryGrid, I subscribe to the onItemViewSlotSelected event and grab the itemInfo associated with that event data. I only read the data of that iteminfo, I do not reassign a new value or alter it in the subscribed function.
After the function is called, the item's overridden values are reset to default values (Though it still says the attribute is override)

To be clear, I have a normal item with primitive attributes, I override a single attribute (in the inspector, not through code) to have a new value. The first time I read the itemInfo, the override value is the new value I assigned in the inspector. But when I click on a different item and then BACK onto that overridden value, its value is now reset to the inherited value.

This shouldn't be intentional? I can post pictures below..

BEFORE/FIRST on select event (assigned in inspector outside of play mode)

1659407104810.png

AFTER first on select event: (During play mode after clicking on the itemViewSlot and triggering the on select event)
1659407137052.png
 
What kind of item is this Mutable/Immutable Common/Unique?
If possible make it Mutable, even if you are changing the value at edit time, it is always better to make it Mutable if the values aren't the default because the save system won't be able to save the data otherwise.

If you are changing the value in the inspector at edit time it should work. Changing it in the inspector at runtime can cause issues.
The only thing that comes to mind is that some values are pre-evaluated. So perhaps for whatever reason you value is pre-evaluated with the wrong value.

To make sure that's not the case. click on the "cog" icon on the top right of your attribute (you can see it in the screenshot you took). A popup with the option to not pre-evaluate should appear. Do the same in the ItemDefinitionManage just in case.
 
It is mutable, unique. I clicked the cog on that item itself to stop pre-evaluation on that particular attribute, I also turned off pre-evaluation for the entire inventory system on the inventory

1659443081395.png

Same thing.
 
In that case something somewhere must be changing the override value.

I'd recommend trying to set a Debug.Log in the Attribute SetOverrideValue function.
To avoid getting spammend you can put a condition. Example

Code:
if(m_Name == "ActiveAttributes"){
    Debug.Log("Value changed to "+newOverrideValue);
}

Feel free to add a break point too to check what's going on in more detail

That should hopefully give us something to go on.
 
Top