UCC Integrations UIS Demo bug

errorCSO

New member
To reproduce; Just run the Demo in UltimateCharacterController\Integrations\UltimateInventorySystem
Go to the Shop and trigger it open, buy or sell something then exit. From now on, the "Gameplay Panel" will always be opened in the BG no matter what Menu panels the player open or trigger. In addition, the camera can freely rotate when those Menus are open, the cursor disappeared.

Original un-modified Demo from Opsive. Latest version with no errors. Would be nice to have a fixed new Demo. Note, only buy or sell something lead to this bug.
 
Good catch.

This is a silly mistake, but it wasn't trivial to find the cause.

You can fix it by changing this function in the ShopMenu script (around the end):

Code:
/// <summary>
/// Close the quantity panel when the panel is closed.
/// </summary>
public override void OnClose()
{
    m_QuantityPickerPanel.Close(false);
    base.OnClose();
}


I'm also changing the DisplayPanel Close function just to be safe:

Code:
/// <summary>
/// Close the panel.
/// </summary>
/// <param name="selectPrevious">Select the previous selectable.</param>
public virtual void Close(bool selectPrevious = true)
{
    if (m_SetDisableOnClose) {
        gameObject.SetActive(false);
    }
    
    if(m_IsOpen == false){ return; }
    
    m_IsOpen = false;
    
    if (selectPrevious) {
        if (m_PreviousPanel != null && m_PreviousPanel != this) {
            m_PreviousPanel.OpenBack();
        }
        if (m_PreviousSelectable != null) {
            EventSystemManager.Select(m_PreviousSelectable.gameObject);
        }
    }
    OnPanelClose?.Invoke();
    OnClose?.Invoke();
    
    for (int i = 0; i < m_Bindings.Count; i++) { m_Bindings[i].OnClose(); }
    if (m_Manager == null) { return; }
    EventHandler.ExecuteEvent<PanelEventData>(m_Manager.PanelOwner, EventNames.c_GameObject_OnPanelOpenClose_PanelEventData,
        new PanelEventData() {
            Open = false,
            OpenBack = false,
            PreviousPanel = m_PreviousPanel,
            PreviousSelectable = m_PreviousSelectable,
            ThisPanel = this,
            SelectPrevious = selectPrevious
        });
}

The problem was that when the ShopMenu was closing is forces the quantity picker to close. The issue is that even though it was already closed the quantity picker was sending information to the display panel manager to set its "previous panel" as the selected panel.
This meant that the Gameplay panel wasn't selected when existing the shop menu. Instead the shop inventory panel was selected.

With the following changes it should ensure that the quanity picker panel does not select its previous panel when the shop menu is closed.

If you find any other bugs do let us know :)
 
If you find any other bugs do let us know :)
Thanks! I assume this fix will also be in the next update right? So we don't have to manually update the script again.

There is actually a minor but annoying bug in the Shop. Clicking an empty item slot in the Shop still bring up the Quantity Picker which is unnecessary. Neither the Main Inventory menu nor the Craft menu do that which is good. Please make the behavior consistent as the rest.

To reproduce in the Demo, sell some items until you have empty slots to click on. For me its no hurry as long as the future updates fix it.
 
Yes this fix will be part of the next update

I'm not sure why I chose to open the quantity picker when clickin on an empty item.

In the ShopMenu in the OnItemClicked function move the QuantityPickerPanel.Open statement bellow the iteminfo None check:
Code:
/// <summary>
/// The event when clicking an item.
/// </summary>
/// <param name="slotEventData">The inventory grid UI.</param>
protected virtual void OnItemClicked(ItemViewSlotEventData slotEventData)
{
    if (m_OpenQuantityPickerOnItemClick == false) { return; }
    var itemInfo = slotEventData.ItemViewSlot.ItemInfo;
    m_SelectedItemInfo = itemInfo;
    
    if (m_SelectedItemInfo == ItemInfo.None) {
        m_QuantityPickerPanel.QuantityPicker.MinQuantity = 0;
        m_QuantityPickerPanel.QuantityPicker.MaxQuantity = 0;
        m_QuantityPickerPanel.QuantityPicker.SetQuantity(0);
        DrawPriceTo((0, m_SelectedItemInfo), m_TotalPrice);
        return;
    }
    
    m_QuantityPickerPanel.Open(m_InventoryGrid.Panel, slotEventData.ItemViewSlot);
 
Thanks again! I followed the fixes & all work fine on my end.
But in scenarios where the QuantityPickerPanel.Open existed, there may be possible of the same glitch. Currently still in an empty Chest. I'm sure the next update you'll take care of it.
 
Yes that's what the second code snippet in the first answer should prevent. Such that it doesn't happen no matter the context.
 
Yes that's what the second code snippet in the first answer should prevent. Such that it doesn't happen no matter the context.
I did some tests. I replaced that code in the Display Panel script, the Chest still has the bug.
Console has no error.
 
That's odd I can't replicate that issue for the chest at all. It works just fine for me.

Did you make any other changes?

Can you try to change this in the ChestMenu... it shouldn't really change anything though...
Code:
/// <summary>
/// Close the UI panel.
/// </summary>
public override void OnClose()
{
    m_QuantityPickerPanel.Close(false);
    
    base.OnClose();
    if (m_DoNotCloseChestIfEmpty && m_Chest.Inventory.MainItemCollection.GetAllItemStacks().Count == 0) {
        return;
    }
    
    m_Chest.Close();
}
 
That's odd I can't replicate that issue for the chest at all. It works just fine for me.

Did you make any other changes?

Can you try to change this in the ChestMenu... it shouldn't really change anything though...
Code:
/// <summary>
/// Close the UI panel.
/// </summary>
public override void OnClose()
{
    m_QuantityPickerPanel.Close(false);
   
    base.OnClose();
    if (m_DoNotCloseChestIfEmpty && m_Chest.Inventory.MainItemCollection.GetAllItemStacks().Count == 0) {
        return;
    }
   
    m_Chest.Close();
}
Using the same Demo. No I made no changes to any other Opsive scripts.
Just to be on the same page, we are talking about replacing the part in DisplayPanel.cs /// <summary>/// Close the panel./// </summary> Right?
If we're to put it in DisplayPanelCloser.cs, please tell me where?
 
Yes in DisplayPanel.cs the Close function.

... I wonder why it works differently for you. Its possible I made other changes since the last update.
I'd recommend waiting for the next update and if it still causes issues at that point we can dig into it in more detail.
 
Top