Endless generation of objects

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JerryHayat

I have a _process (delta) function in which an object is created in the range of a variable (15 pieces), but it does it continuously. Using _process (delta) is mandatory for me.

func _process(delta):
	for i in range(inventorySize):
	var slot = SlotClass.new(i, 'none')

	slotList.append(slot)
	$inv_ui/zpa/Container/GridContainer.add_child(slot)
:bust_in_silhouette: Reply From: rakkarage
var _done = false
func _process(delta):
    if not _done:
        _done = true
        _do()
func _do():
    pass