Drag and Drop Equipment Panel Problems

Bernkastel

Member
1. The setup in my picture below is as follows: I have an inventory with weapons, accessories, and consumables.
Below that panel is an equipment panel.

1629702483384.png



Following the item view slot container guide, I created an equipment panel with a drag/drop setup. I changed the width/height of these equipment item view slots by hand from the default 100x100 to 200x200. In the screenshot you see that as I drag a weapon onto the weapon slot, the green item view is far smaller, probably the same size as the original 100x100 item slot. How do I make this size up? It seems that the Item View For Grid's settings are changed to something else once the scene starts. I have Disable on Clear = False for Icon Item View for example, but after starting the scene it is set to True.

Basically I just want control over what the hover image looks like, its functioning correctly except it creates a small preview of the item that doesn't fit the actual item view. I feel as though despite making my own changes to the item view slots, its spawning different item views on initialize.

2. Other issue I'm having that I can make a separate post about potentially, when I equip an item into an equipment item slot, and then drag and equip another item, the first item will often disappear and show as an "empty" item view slot before randomly refreshing.

First Image (dragging a second item onto an already equipped item)

1629702512655.png


Second Image: (After dragging the purple weapon onto the equipment slot, the orange item slot disappears... it will later reappear after clicking on items and refreshing the panel.

1629702530972.png
 
This is a view of the inventory/Equipment view in editor before pressing play, lemme know if you need more specific information.

1629702792973.png
 
1)
Most of the time ItemViews are set at runtime using a prefab. So the ItemView in the scene is replaced by a new one as soon as the game start, and each time a new item is assigned to it. Mainly because you can have different ItemViews depending on the ItemCategory of the item assigned.

The ItemViewDrawer is the component that replaces the ItemView and shows the new content. The component that controls the ItemViewDrawer is the ItemViewSlotContainer (in the case of equipment that's the ItemSlotCollectionView)
1629713657154.png
You can either change the prefab assigned depending on the ItemCategory of the item (or when it is empty).
Or you can set the "Swap Item View On Assign" to false, which will not spawn any of the prefabs, and isntead it will use the ItemView existing in the scene



2)
What kind of DropAction are you using? Normally the "ContainerSmartExchange" should automatically tell the ItemViewSlotContainer of the origin item to refresh.
1629713813407.png
There is always the solution to referesh it manually adding another custom DropAction if necessary
 
Ty for the reply, for your first response I'll make a separate prefab and assign each one to the item view drawer and see how that works, it sounds like the issue. For the second issue, I'm using the default setup that the equipment panel populates on creation.

1629720880433.png
 
That's weird for the second issue...
Do you have the Draw on Inventory update active?
1629728729843.png

What Version are you using for UIS? The latest is v1.1.8

Check the hierachy at runtime when the ItemView is empty, check the image for the Item Icon. If the Image is None then the ItemView is probably empty, if the Image is the ItemIcon of the Item that should be there but the Image components is disabled, then perhaps there is a bug with the Drop preview View.
 
Using 1.1.8
Here is a screenshot of dragging the second weapon in to equip over the first item. First item's inventory grid becomes gray. I have it open in the inspector and the image is disabled.

Draw on Inventory Update is also true

1629730230126.png
 
That's the ItemViewSlot,
Could you check the Image component used to show the item Icon, it should be inside the ItemView, which is inside the ItemViewSlot.
Also show me a screenshot of your ItemView components, especially the DropPreview one.

In the UIS demo you can also drag and drop to equip and it seems to work fine. So perhaps try comparing your item views, and item view slot containers with the ones from the demo scene. That might help you find the issue.
 
Top