0 votes

I ihave a node2d in my scene(Named enemies) and I basicly instance enemies as a child of it's. I wanna detect when all the enemies are killed aka. when there is no child left as a child of node2d. I tried checking children count in process function bt it returns true every frame of childlessness, I just want the exact moment to trigger a function

Godot version latest
in Engine by (70 points)

1 Answer

0 votes

You're probably looking for get_child_count(), which does as it says. It should return 0 when a node has no children. Though, you'll have to ensure you're actually removing the children when they're killed for this to work...

by (16,712 points)
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 [email protected] with your username.