Skip to content

Grid Item_Dropped signal only giving weakref for item? #124

Answered by peter-kish
Karbonicc asked this question in Q&A
Discussion options

You must be logged in to vote

You should still be able to access the InventoryItem via WeakRef.get_ref (bare in mind that it can return null - see the docs for WeakRef) . Something like:

var item_node: InventoryItem = item.get_ref()
if item_node == null:
    return
# do something with item_node

I used weak references here, since in cases where the item is dropped into another inventory, there's the possibility of it being "consumed" if it gets merged with another item. In that case the weak reference will contain null.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Karbonicc
Comment options

Answer selected by Karbonicc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants