C++ and C# interop

Godot Version

Godot 4.5

Question

Hi! Making GDScript and C# programs communicate is documented but what about making C# code communicate with C++ code from a GDExtension, using godot-cpp? Is it hard? Can I say call a method from a node in a C++ GDExtension easily from C#? Will Godot automatically generate bindings for custom GDExtension nodes the same way it generates bindings for built-in nodes?

There are basically two ways:

  • Generate your own c# using PInvoke (not sure if 4.6 already made that easier)
  • Via call() to a GoodObject (when you don’t have the corresponding c# type)

So it’s possible but not optimal (that would be the automatic generation by Godot itself when you load a GDExtension)

1 Like

Thanks for the reply !