Godot Version
`4.2.1
I am trying to add a new custom resource to my characters inventory array using a for loop and cannot understand why it wont work.
the inventory is an array of “Inv_Slot_data” resources.
func _ready():
inv_data.slot_datas[4] = Inv_Slot_Data.new()
inv_data.slot_datas[4].item_data = LOG
var player_inv = inv_data.slot_datas
for slot in player_inv:
if slot == null:
print("empty")
slot = Inv_Slot_Data.new()
slot.item_data = LOG
the first 2 lines where I specify what index of the array to create a resource for work like a charm. when I try replicate this in a for loop it just doesn’t do anything, no errors nothing. I have tried printing all the results and everything matches but i just doesn’t want to create a resource when in a for loop