No announcement yet.

Inventory Slot problems

  • Filter
  • Time
  • Show
Clear All
new posts

    Inventory Slot problems

    I have a simple inventory with drag and drop, almost working.

    The thing I can't fathom is: When dragging and dropping an object from one slot to another, when I drop the object onto a new slot how can I update the old slot (to show its now empty).

    I have a grid panel of slots and I have a drag and drop operation.

    The drop event happens on the destination slot I can't call an update on the original slot from the destination slot !!

    What am I doing wrong ??


    You can create your own drag operation blueprint (in the content browser) and have it carry additional data - add any variables that you may need, in your case a previous parent reference perhaps.

    Click image for larger version  Name:	Annotation 2020-06-30 090627.jpg Views:	0 Size:	31.6 KB ID:	1782590

    You'll have access to it when you drop:
    Click image for larger version  Name:	Annotation 2020-06-30 090809.jpg Views:	0 Size:	32.6 KB ID:	1782591

    Alternatively, you can have the dragged widget itself carry that reference but that's usually not the right way to do it.

    Another alternative, for when things get complicated, you can have an entire new actor serve as Payload:

    Click image for larger version  Name:	Annotation 2020-06-30 091437.jpg Views:	0 Size:	57.2 KB ID:	1782593‚Äč
    Extending a drag operation is usually preferable and enough, and the most sensible thing to do.

    edit: Nothing really stops you from plugging the entire widget you're dragging from into the drag operation.
    Last edited by Everynone; 06-30-2020, 04:24 AM.