0 votes

I can't "import" a C # class into godot. I think I forgot about something, but I can't find more information in the documentation.
I have created a class in c # in visual studio, and I wanted to be able to call its methods from Gdscipt.

I have found this material in the documentation, I should simply write this and it will load:

var my_csharp_script = load ("res: //csharpclass/myClass.cs")
var my_csharp_node = my_csharp_script.new ()
print (my_csharp_node.str2) # barbar

In this case, mycsharpscript is null, and I don't understand why (I have myClass.cs in this folder correctly). The only thing I observe is that I cannot see my cs file from Godot's explorer, which I don't know if it is normal, or I need to configure something else for all this to work.

Godot version 3.3.4
in Engine by (30 points)

You need to show the C# and/or output window. I suspect your class name differs from your script name; this should show in the debugger. You also have an extra space after res: in the string you're passing to load. The file should show in godot's explorer - it's worth confirming it is in the correct location.

You've likely seen the documentation:

https://docs.godotengine.org/en/stable/getting_started/scripting/cross_language_scripting.html#instantiating-c-nodes-from-gdscript

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