Open AbanoubNassem opened 2 years ago
When you interact with the Godot API (here via the signal system) it limits what you can write in the function signature. In Godot Strings are internally refcounted, so this doesn't actually copy the string, it only does a bit of refcount bookeeping. It's arguably still more than passing a pointer but it's not as bad. Maybe the binding system could be improved to support such signatures, but I it doesnt guarantees Godot will use a pointer to string all the way (especially if it gets converted to Variant at some point).
I'm trying to connect the
animation_finished
event as follow:but I get this error:
however if I made the method accept normal String not by reference , it works fine
void Hero::AnimationFinished( String animation) {}
but isn't that unnecessary copying the parameters on each call?