Cycled node creating. Script-created nodes doesn't use script

Godot Version



I want to area2d to grow a lot of objects: every created object creates another ones, but only first object creates nodes

extends Area2D

const positions = [Vector2(1, 0), Vector2(0, 1), Vector2(-1, 0), Vector2(0, -1)]

func _on_timer_timeout():
	for i in range(4):
		var c = duplicate()
		c.position += positions[i] * 8


From the documentation for the autostart property:

Note: This property is automatically set to false after the timer enters the scene tree and starts.

So when duplicate the scene autostart will be false! Just start the Timer manually in your _ready function:

func _ready() -> void:
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.