0 votes

I have a scenario in which I need to spawn hundreds of obstacles in front of the player. I don't need them anymore once player.transform.origin.z > player.transform.origin.z. But I need to spawn nodes continuously in front of the player.

So which is more efficient:-

  1. Deleting unneeded node and creating new Node
  2. disabling node (by removing it from the tree since there is no enabled property like Unity) and re-enabling it (adding it again to the tree) and changing its position
in Engine by (12 points)

1 Answer

0 votes

In terms of performance I don't think it will matter as long as you manage the total number of objects. In my experience it's been simpler to keep independant "spawning" and "despawning" logic. Might well depend on what you want to do with your project though.

by (92 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 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.