Stat Preview Item View

I am using the Stat Preview Item View to showcase what the characters current Defense and Warmth rating are based on the clothing equipped. But what I have noticed is that the Item Description doesn't update it as often as I would like to. These are the scenarios I am talking about:

1. The first time the Menu Panel with the Equipment is open. The values shown are incorrect. If I close and reopen the panel, or change my selection to a new item it fixes itself.
2. When I equip something, or drop an item onto an equipment slot, or drag and drop a piece of equipment off. I notice that the Stat Preview doesn't update and fix itself until I hover over a new object.

It's also possible I am missing a checkbox or too, which would be awesome if that's the case.

Video of issue: https://streamable.com/9h3gyf
 
By default the Description draws on select.
My guess is that the item view slot does not get selected after the inventory is redrawn, because it is already selected.
Someone had a smilar issue with that, but my fix wouldn't solve your problem. I'll need to look at this in more detail. We are hoping to push an update soon so I'll try to find a fix asap.
 
I was unable to reproduce your issue, probably because my setup is slightly different.
Could you try this change within the ItemViewSlot class
C#:
/// <summary>
/// Set the item info.
/// </summary>
/// <param name="itemInfo">The item info.</param>
public virtual void SetItemInfo(ItemInfo itemInfo)
{
    if (itemInfo.Item == null || RandomID.IsIDEmpty(itemInfo.Item.ID)) {
        m_ItemView.Clear();
        UpdateUI();
    } else {
        m_ItemView.SetValue(itemInfo);
        UpdateUI();
    }
    if (m_Selected) {
        OnSelect(null);
    }
}
/// <summary>
/// Set the item view.
/// </summary>
/// <param name="itemView">The item view.</param>
public virtual void SetItemView(ItemView itemView)
{
    m_ItemView = itemView;
    targetGraphic = m_ItemView != null ? m_ItemView.TargetGraphic : null;
    if (m_ItemView == null) { return; }
    m_ItemView.SetViewSlot(this);
    if (m_Selected) {
        OnSelect(null);
    }
}
/// <summary>
/// Invoke OnSelect even if it was already selected.
/// </summary>
public override void OnSelect(BaseEventData eventData)
{
    base.OnSelect(eventData);
    if (m_ItemView != null) {
        m_ItemView.Select(true);
    }
}
 
So that solved a few scenarios for me:

Worked in these cases:
  • Drag and drop items from inventory panel onto the equipment
  • Clicking Unequip from the item action panel on the equipment panel
Didn't Work in these cases:
  • Drag and drop items from the equipment panel back to main inventory
  • Clicking equip from the item action panel in the inventory panel
This led me to believe it was an issue relating to the Inventory Panel. I investigated the differences between how the two panels were different. I needed to set a different prefab for the Empty Item View that the Filled One. I was initially using the same prefab for both. I just created a prefab variant of the original one with no actual changes and this made it work properly.

I then disabled the code you provided just to see if that was helping or not, and it looks like I did need that code as well to make it all work.

Thanks so much for the help!! It's so cool to see everything come together!
 
Top