+1 vote

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 ?

in Engine by (50 points)

1 Answer

+2 votes

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.

by (106 points)

is this possible in gdextension? godot 4?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.