Root Node2D with child Area2D vs root Area2D

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

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 =)

:bust_in_silhouette: Reply From: kidscancode

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.