I've got my code set up like this:
if slots[PlayerInventory.active_item_slot].item != null:
active_item_label.text = slots[PlayerInventory.active_item_slot].item.item_name
else:
active_item_label.text = ""

making sure that an item is not null before checking things, however when i queue_free the item and erase it from the inventory dictionary, it says "attempted method check on a deleted object"

i've even tried manually setting the item to null and it still hasn't worked, ideas or thoughts?

  • You can use is_instance_valid(item) to check to make sure the object hasn't been deleted from memory yet.

You can use is_instance_valid(item) to check to make sure the object hasn't been deleted from memory yet.