+1 vote

Hi. I've been following video tutorials to quickly get to grips with Godot. I've also been converting any associated GDscript to C#, as that's what I'm familiar with.

One tutorial creates a class (extending the Resource class) to generate data objects. This custom class implements the class_name keyword so that it will be selectable from the *Create New Resource* interface.

My question is: how can I replicate this within a C# script?

For bonus points, is there a resource where I could have found this information? I've yet to find good documentation on Godot's implementation of C#.

in Engine by (28 points)

1 Answer

+1 vote

This might be worth opening an issue on github for.
I've played around a bit and haven't been able to find anything. Maybe C# can't export resources in 3.2?

In general though, the C# class name replaces the need for the class_name keyword.
Eg, if I have a Card C# script attached to a node, with an Attributes property, I can read it with:
var attributes = GetNode("path/to/card/node").Attributes;

by (184 points)
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.