+2 votes

Hi, maybe it's a silly question but I was wondering what's the preferred way between these two cases :

For example for a Node2D with a Sprite and an Area2D

- Node2D
  - Area2D
    - CollisionShape2D
  - Sprite

vs

- Area2D
  - CollisionShape2D
  - Sprite

I'm tempted to do the 2nd way, because Area2D is a Node2D and it seems logical that less nodes is better in term of performance.

But the editor seems to encourage the use of Node2D, Node3D or Node as root (they are the firsts proposed when creating a new scene and you have to click "Other nodes" to be able to select an other type of node).

Thanks in advance =)

in Engine by (17 points)

1 Answer

+3 votes
Best answer

Your intuition is correct. There is no point in having an extra Node2D, and in fact it can complicate things unnecessarily.

It's not so much that the editor encourages it, as it just has those 3 defaults. You don't have to click "other nodes", btw, you can also click the "+" for "add a new node.

by (20,899 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 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.