0 votes

I'm making a game with Enemies, but every time i spawn a new enemy, that enemy doesn't react to the signals, because hes from another root scene, so how i can connect them between scenes?

in Engine by (22 points)

1 Answer

0 votes
Best answer

If that enemy has his own script

# Connect the signals
func _enter_tree():
    connect ("onDeath", current_scene, "_enemy_died")

# Disconnect all signals
func _exit_tree():
    disconnect ("onDeath", current_scene, "_enemy_died")
by (5,012 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.