Crash using a GDExtensions functions that tooks Ref as parameter.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MatSox

Hi,
I’m haing a crash if I try to call from GDScript a function defined in c++ that tooks a Ref (or an Object) as parameter.

the definition is the following:

int gd_apply_effect(Object* p_effect);

and the binding:

ClassDB::bind_method(D_METHOD("apply_effect", "effect"), &MapUnitAvatar::gd_apply_effect);

The creah occurs when I call this function via GDScript.
If i try to call a function that tooks an int or a float as parameter everything works fine.

Thank you.

What you have provided seems correct already, what does yourgd_apply_effect method declaration looks like?

0 | 2023-06-09 21:23

The declaration il the one I wrote above. The problem
Is only if I pass Objects or Refs as parameter, otherwise
It works fine.
I can try to send you the exact error in the GDExtensions
If it’s useful.

MatSox | 2023-06-10 15:17