Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | wooshuwu |
I am trying to use a function that is defined in a GDNative in my c# script. I tried doing something like this but it will not let me convert from the “new” object to a Node and thus I can’t do the function call. Is there a different way or a step that I am missing to achieve this?
If you can get it as an Object
you could use obj.call("function_name", ...)
. Strange that it would not let you cast it to Node
though. You should be able to cast it, C# is strongly typed so it doesnt implicitely cast.
Zylann | 2022-02-22 22:11
Thank you @Zylann, your comment helped me realize that there are 2 different types of object classes, I was using the wrong one and should have been using the Godot.Object
type rather than a general c# object
type. With the general c# object type it would not allow the cast nor did it have a call method. The Godot.Object
type allowed both the usage of the Call method and the casting to a Node (which I no longer needed due to the Call method working on the Godot.Object
working).
wooshuwu | 2022-02-23 00:12