Duplication problem with scenes.

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

I have a main game scene inside I have my player scene and my Enemy scene, when I duplicate my enemy scene with Ctrl+D the duplicated one doesn’t work as it should but the original one is working properly.

doesn’t work as it should

Is not actually a problem description.

sash-rc | 2020-11-15 17:01

It doesn’t recieve signals as it should. Sorry for not being clear, I was just so frustrated.

Zuckey | 2020-11-15 17:09

:bust_in_silhouette: Reply From: witch_milk

duplicated scenes will share the same exact script as the original one which can create some problems. Perhaps this is the issue? Maybe try deleting the script on the duplicate and making a new one?

Tried this but no luck.

Zuckey | 2020-11-17 18:36

:bust_in_silhouette: Reply From: sash-rc

It doesn’t recieve signals as it should

Signals in editor are attached to concrete nodes. Move signal handler to higher Node in tree hierarchy instead. And call your Enemy’s method (for each enemy) from there.
You can use group feature for this purpose.

get_tree().call_group("enemies", "enemy_method")

or simply iterate children and call enemy.enemy_method()

Couldn’t understand the part do something with all its children, how do I do that?

Zuckey | 2020-11-17 18:37

updated answer, hope it’s clearer now

sash-rc | 2020-11-17 23:23