It is not possible to save a reference as an variable ?

For a few days i’m trying to make my own inventory in blueprint, for the inventory management it was easy, but with multiple inventory the system seem to bug. For simplicity, i have 3 inventory : toolbelt, main and other (with their copy for calculations), and 2 other inventory on the character blueprint. When my mouse is hover the inventory, i pass the inventory ref with “pass-by-reference” and i put it on “InventoryStartRef”, if the mouse is hover the toolbelt its the same, this varaible is only here to be the reference. And when a drag enter is detected the “InventoryEndRef” is set with “pass-by-reference”. When i move an item with drag’n’drop and the item is dropped in a new case i have the “InventoryStartRef” with the ‘hover’ and the "InventoryEndRef " with ‘drag enter’ and their locations. But items aren’t moving between inventory, they seem to be a copy instead of a reference. Here some screenshot.
111409-capture+d'écran+2016-10-18+15.48.50.png

(input use pass-by-reference)


You can’t create a reference to a struct in blueprints as far as I know. You need your item to be inherited from object.

When you Get on a struct array, you get a copy. Have a look here.

@Pepeeee : How can I dot that ? @Everynone : Yeah i have seen, but how it is possible to not have this possibility ?

Extend Object, don’t use a struct if that’s what you want, to actually move the items from one array to another.

Otherwise, just store an index or pointer to another structure that actually holds all the data and your inventory area’s just store index’s to the master list of all items. Then, remove the index from one and add it to another when you simulate moving an item.

I’m not sure if I totaly understood waht you said but I have created an object called “bp_inventory” and childrens from this element that I have posed in the world, i initialize them in the construction script of the charactere. The rest of the code has slightly changed but it’s basically the same. And now my inventory is operationnal !! Thanks for help !

item_bp2.png

I have an other question but i have created a new thread here : Question about drag'n'drop - Blueprint - Unreal Engine Forums