Display equipment in mirror hotbar?

Robot_Nachos

New member
I'd like to repurpose a mirror hotbar to display the players equipped items, rather than an inventory grid. Unfortunately I'm not quite sure how to convert the Equipment Mirror Hotbar script to read an Item Slot Collection.
 
I'm not sure I understand.
Why not use a ItemSlotCollectionView (aka equipment panel) as your hotbar

We even have a feature scene showing how that can be setup.

The Mirror Hotbar only works on InventoryGrids as it Mirrors the first few slots in the Grid, It doesn't work on anything else.
 
Oh, I'm sorry, Specifically I'm trying to make a hotbar that mirrors a slot in an existing item slot collection view that have their assigned equipment equipped elsewhere. I've tried making another equipment panel and disabling the slots I don't need but it doesn't seem to work and feels like the wrong approach. I found this thread from a while back but couldn't recreate what that user was doing successfully.
 
Last edited:
So you just want to Mirror a subset of slots from an equipment panel....
Unfortunatly we don't have anything for that out of the box.
You can write some custom code for it though.

That being said your first approach sounds good to me. Use an ItemSlotCollectionView, and simply hide/disable the slots you don't want to show. It should be possible.
 
Ok so before when I just tried use the UI designer to make a new equipment slot set it didn't mirror the existing slot set. I tried going simpler and duplicating the existing equipment item view slot container manually. That mirrors my equipment correctly, but also causes a null reference exception.

Any Ideas?

Code:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerItemActionBindingBase.NotifyItemActionInvoked (Opsive.UltimateInventorySystem.UI.Item.ItemViewSlot itemViewSlot, Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, System.Int32 itemActionIndex) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerItemActionBindingBase.cs:217)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotsContainerItemActionBindingBase.HandleItemActionInvokedFromPanel (System.Int32 itemActionIndex) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotsContainerItemActionBindingBase.cs:162)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ActionPanel`1[T].AfterActionInvoke (System.Int32 index) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ActionPanel.cs:175)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ActionPanel`1[T].InvokeAction (System.Int32 index) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ActionPanel.cs:131)
Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ActionPanel`1+<>c__DisplayClass18_0[T].<OpenInternal>b__0 () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ActionPanels/ActionPanel.cs:77)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton.Press () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:88)
Opsive.UltimateInventorySystem.UI.CompoundElements.ActionButton.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/CompoundElements/ActionButton.cs:152)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:262)
UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:385)
 
It looks like the issue is that the ItemViewSlot.ItemView.Modules is returning null...
Mostl likely the ItemViewSlots you are disabling are never initialized so either the ItemView or the Modules list is null.
Can you add a null check

Code:
if(itemViewSlot?.ItemView?.Modules == null){
    return;
}
Just before the error.

Also do you need the itemActionBinding for that part of the UI? if not you can remove that component
 
Top