ItemViewSlotContainerItemActionHandler and chests

Paramedic

Member
I want to have ItemViewSlotContainerItemActionHandler and ItemViewSlotsContainerCategoryItemActionSetBinding to handle moving items from chest to inventory by pressing keyboard key. Unfortunately it does not work. When I open chest, ActionHandler turns off:
View attachment 10191
When I try to turn it on I got an error message:
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateInventorySystem.Input.SimpleInput.CheckInput (Opsive.Shared.Input.IPlayerInput playerInput) (at Assets/Plugins/Opsive/UltimateInventorySystem/Scripts/Input/SimpleInput.cs:81)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.ItemViewSlotContainerItemActionHandler.Update () (at Assets/Plugins/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/ItemViewSlotContainerItemActionHandler.cs:67)
I think problem can be because ItemUser is not assigned property, and I have no idea what is the reason of it. Panel owner is assigned correct to panel manager.
1673898035142.png

I have also another question, how should item action be set up properly to move items from chest to player inventory? This is how I did it but I can't test it yet, because of bug above, I am asking in case:
1673898169219.png

And how can I remove this blinking slot effect when I press enter on slot?
 
Last edited:
The chest menu by default already has the code built in to take items from the Chest and put them in the characters inventory. Without needing to add any Item Actions.

After looking into it in depth it seems using item action on a chest menu is not allowed. Because the input component is searched for on the ItemUser of the bound Inventory. And the ChestMenu sets the Chest Inventory when opened.
1674225390712.png
And in turn it sets the player input here in the ItemViewSlotContainerIndexedActionsHandler
1674225643125.png
So unfortunatly it will not be possible without making some changes to the code.


I would recommend a few choices.
1) Use the Chest Menu as is where you click on an item to take it.
2) Or make a custom ChestMenu (either by copy pasting or by inheriting) and change the code such that it does what you want
3) Or Instead of a ChestMenu use a completely different approach. In the demo scene we showcase an example of a "storage" InventoryGrid where you can add and remove items. Since it is simply an InventoryGrid you can add item actions or make your own custom code to interact witht the items.
4) Or Make your own custom ItemViewSlotContainerItemActionHandler, ItemViewSlotContainerIndexedActionsHandler, or ItemViewSlotContainerNamedItemActionHandler where you handle input the way you want without getting the player input from the ItemUser at all.

I will take note of this limitation and add it in list of things to review in a future majore update.
I'm very sorry for the inconvinience.
 
So in the next update coming later this week

you'll be able to set

m_AutoSetItemUser = false in the ItemViewSlotsContainerItemActionBindingBase.

Then you will need to manually call the function
SetItemUser(itemUser) on the ItemViewSlotsContainerItemActionBinding component. Where itemUser will be the ItemUser component on your character. This will allow your own character as the ItemUser instead of getting the ItemUser of the chest inventory which probably does not exist.

I hope that helps, sorry for the wait
 
Top