Hello !
There is a little something that I fail to understand.
When we emit the “enemy_spawned” signal from the enemy_spawner script, we comment the “add_child” from here to instead do it in the game script. But I actually forgot to comment this line, so the “add_child” command was in both the game script and the enemy_spawner script. What I expected from my error was to have enemies added to both nodes on execution, still they were only in the Game one. So it works perfectly, but I cannot quite understand why. Do you have any ideas ? Thanks !

Update : maybe this is related to execution order. If an instance is unique and cannot be added multiple times (am I correct ?), so it would be added first to the Enemy_spawner, then to Game.
Update 2 : Actually in this case, the first add_child to be executed is the Game one. So it means the Spawner one would be ineffective since the instance was already added once. I think.

This is an excerpt from the official documentation on the add_child method

So I think my call in the spawner script actually just silently fails


just done a quick test, and yea, it fails if called twice.
shows me this in the debugger, doesnt crash the game tho

1 Like

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

Privacy & Terms