0 votes


I am trying to send a signal from C++ using native plugin. I have managed to send a signal with any of the defined data classes like int, string, color etc however I cannot figure out a way to send signal with a custom object.

I have realised that it is possible to send a signal of any Variant, and Variant constructor accepts type Object but I cannot find any example how to do it.

class MyData : public Object {

class Simple : public GodotScript<Reference> {
    void _init() override {
    void say() {
         owner->emit_signal("mySignal", new MyData());
    static void _register_methods() {
         register_method("say", &Simple::say);

extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) {

extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *o) {

extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) {

I have tried to wrap MyData object in GodotScript, use macros GODOTCLASS , GODOTSUBCLASS. When I run the code I either have null instance when called ".new" so something is wrong with library or object from signal is null or its just "Object" with no way to cast it to my object.

Additionally is there anyway to see more detailed log of error in godot for loaded libraries?

asked Jun 24, 2018 in Engine by mikekulasinski (26 points)

Please log in or register to answer this question.

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 How to use this Q&A? before posting your first questions.