Access GDScript class from C++ in GDExtension

Godot Version

4.3

Question

I am trying to create a GDExtension class to run an algorithm on an array of objects created from a GDScript class. Is there a way to #include the GDScript class or create variables of its type in C++, or do I need to rewrite the class in C++?

1 Like

Definitly not through #include, that’s a pre-processor instruction. However, I believe you can get values by taking a Object and using the .get(property_name) function. Not very type-safe but it should work, you might have to re-compile often to keep it aligned with GDScript so it may be better to convert the class to C++.

1 Like

Thanks for the advice!