Is it possible to "export variables" to Editor when using GDNative/C++

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MaximeG
:warning: Old Version Published before Godot 3 was released.

It is possible to export variables in GDScript so they are available in the editor :
eg : export var health = 100 will make the health value editable in the editor.

Will this be possible in GDNative/C++ too ?

:bust_in_silhouette: Reply From: Karroffel

Sorry for the late reply, I didn’t check here in a while…

Yes, that already is possible! It looks different in different language bindings.

// C++
register_property("health", &Player::health, 100.0);

// D
class Player : GodotScript!KinematicBody {
    @Export
    float health = 100.0;
}

I think that’s how the D version works, but I can assure you that that’s how the C++ bindings do it.

Those exported properties show up in the inspector and even update when you recompile the library.

is this possible in gdextension? godot 4?

mohamedwalidxx | 2022-10-19 17:19