0 votes

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?

Godot version v3.3.4
in Engine by (52 points)

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.

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).

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 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 webmaster@godotengine.org with your username.