Adding Nodes Created in the Stack to the Scene Tree in GDExtension.

Godot Version



I have recently started using C++ with Godot and have noticed something weird. If I initialize a node in the stack as shown below:

Node3D node3dTest = Node3D();

The code compiles and node3dTest appears in the scene tree in the editor. However, the _ready(), _process(), and _input() functions are never called. If it is initialized in the heap there is no issue.

Node3D* pNode3dTest = memnew(Node3D());

I can’t find much online about it but do nodes need to be created in the heap to work properly? Is there no way to store them in the stack?