Creating Node3D arrays in GDExtension

Godot Version

Godot 4.2


How to create Node3D arrays in C++ using GDExtension?

I have been trying to port my GDScript code to C++, but I can’t figure out how to make an array compatible with classes such as Node3D in C++. Here is the code in GDScript:

var particles: Array[Node3D]

I have tried Array and TypedArray in C++, but when I try to push my Node3D instances, I get the following error:

Array particles;


void BHNodeTest::add_particle(Node3D particle)

error: cannot convert ‘godot::Node3D’ to ‘const godot::Variant&’

You want typedarray,

TypedArray<Node3D> particles;