Can not close floating panel.

Kehaw

Member
Hello, I have two questions.

First of all, when I cose inventory panel, the equipments panel show up again.

The second is I can not equip my weapon via drag drop.

All details in this video:


Thank you.
 
Thank you for the video it really helps me understand the issues.

1. For the panels, that's a pretty common issue. By default when you close a panel it will open the "previous" panel. That's very useful when nesting panels, but no so much for floating panels how you have it.

Rather than calling the "SmartOpen" function when pressing the Inventory button, call the "Open" function

Or if you would rather this be the default, when calling SmartOpen/SmartClost then you can edit the source code at line 200 of DisplayPanel.cs script:

Code:
public virtual void SmartClose()
{
    Close(false);
}


2. This is also a pretty common issue. Dragging and dropping uses a something called a DropAction. You can learn more here:
and here is a video tutorial on that subject:

There are two states of equipping an item on a character. "Soft" Equip and "Active" Equipped. When you drag and drop, a "smartDrag&DropAction" is used to add the item to the equip collection. At that point it is "Soft" Equip. If you check the demo scene you'll see what I mean:
1715587170810.png

It is equipped, but it's not actively equipped.

If you want the item to be actively equipped on drag and drop then what you will need is to change the DropAction to use the CharacterEquipItemAction when dragging your items from your player inventory grid to your equipment window.

Something like that should do the trick:
1715587393741.png
Make sure the drop condition/action is at the top, and make sure the SourceContainer and Destination Container names are the correct ones (It's the DisplayPanel name where your items are displayed)

I hope that makes sense
 
Thank you for the video it really helps me understand the issues.

1. For the panels, that's a pretty common issue. By default when you close a panel it will open the "previous" panel. That's very useful when nesting panels, but no so much for floating panels how you have it.

Rather than calling the "SmartOpen" function when pressing the Inventory button, call the "Open" function

Or if you would rather this be the default, when calling SmartOpen/SmartClost then you can edit the source code at line 200 of DisplayPanel.cs script:

Code:
public virtual void SmartClose()
{
    Close(false);
}


2. This is also a pretty common issue. Dragging and dropping uses a something called a DropAction. You can learn more here:
and here is a video tutorial on that subject:

There are two states of equipping an item on a character. "Soft" Equip and "Active" Equipped. When you drag and drop, a "smartDrag&DropAction" is used to add the item to the equip collection. At that point it is "Soft" Equip. If you check the demo scene you'll see what I mean:
View attachment 12641

It is equipped, but it's not actively equipped.

If you want the item to be actively equipped on drag and drop then what you will need is to change the DropAction to use the CharacterEquipItemAction when dragging your items from your player inventory grid to your equipment window.

Something like that should do the trick:
View attachment 12642
Make sure the drop condition/action is at the top, and make sure the SourceContainer and Destination Container names are the correct ones (It's the DisplayPanel name where your items are displayed)

I hope that makes sense
Thank you very much!

Now, I have a little bit confuse about ContainerHasName's params. What I understand it is this:

1715613598572.png

But when I set the name, it is not working:

1715613738943.png

I add some debug info and print the actual name, they are:

1715615714359.png

Okay, now it works fine for me.

But when my weapon draging through Inventory Grid Panel, application throws an error at the first time:

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.DropConditions.ItemViewDropContainerHasNameCondition.CanDrop (Opsive.UltimateInventorySystem.UI.Item.DragAndDrop.ItemViewDropHandler itemViewDropHandler) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/DragAndDrop/DropConditions/ItemViewDropContainerHasNameCondition.cs:57)


1715614899792.png


Now I add some condition code, this error fixed, but I don't know it is my problem or UIS's bug:

1715615355118.png
 
Last edited:
Back
Top