class_name InventoryUI extends Node func update(inventory: Inventory): for item in inventory.items: var count = inventory.get_item_count(item) update_item(item, count) func update_item(item: String, count: int): var child = get_node(item) if child == null: return var label = child.get_node("Count") as Label label.text = str(count)