While working a bit on inventory-related systems for one of my game modes I discovered an inventory UI script case that is not covered. If you drag and drop an item to a target storage, but that does not have enough space for it and it ends up in a different storage the UI code still only updates the storage you originally dragged and dropped it to. This causes a temporary desync of the inventory menu until all other storage (including the one the item really ended up in) are refreshed. You can see this in action in the video I attached.
Here is the cause of the problem:
SCR_InventoryMenuUI::MoveItemToStorageSlot
... m_pCallBack.m_pStorageTo = m_pFocusedSlotUI.GetStorageUI(); ...
SCR_InvCallBack::OnComplete
if ( m_pStorageTo ) { if ( m_pMenu ) { if ( m_pStorageTo == m_pMenu.GetStorageList() ) { m_pMenu.ShowStoragesList(); m_pMenu.ShowAllStoragesInList(); } else { m_pStorageTo.Refresh(); // <<<<<<<<<<<<< only the target storage is refreshed, but that one is NOT the one the item ended up in } } }
As for a proposed fix, I have a vague idea of maybe setting "current callback" via a static field that is set before the operation is started. Then the SCR_InventoryStorageManagerComponent::OnItemAdded will trigger and set the m_pStorageTo to the correct storage for the storageOwner parameter. That way the target storage that really did receive the item is updated. Probably not the best solution though, but that I leave to the inventory scripter ;)