We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
General GDScript improvements.
For now it's not possible to get class name string (custom, not RefCounted) from Reference object out of box.
RefCounted
I found it's already has been discussed in Q/A: https://godotengine.org/qa/50783/get-class-name-as-string-from-class-reference https://godotengine.org/qa/46057/how-to-get-the-class-name-of-a-custom-node
But still not implemented.
Of course it can be workarounded with custom variable or function. But it's would be much more convenient if it's will be awailable out of box.
Described above.
For example through some property or function like get_custom_class()
class MyClass: pass class MyChildClass extends MyClass: pass func _ready(): print(MyClass.new().get_custom_class()) # will print out: MyClass print(MyChildClass.new().get_custom_class()) # will print out: MyChildClass
Yes, it's can be workarounded by custom variable like this:
class MyClass: var _class_name: String = 'MyClass' class MyChildClass extends MyClass: func _init(): _class_name = 'MyChildClass'
or by custom function like this:
class MyClass: func _get_class() -> String: return 'MyClass' class MyChildClass extends MyClass: func _get_class() -> String: return 'MyChildClass'
But that is tedious enough.
Beacause it's a GDScript core improvement
The text was updated successfully, but these errors were encountered:
Related to godotengine/godot#21789.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Describe the project you are working on
General GDScript improvements.
Describe the problem or limitation you are having in your project
For now it's not possible to get class name string (custom, not
RefCounted
) from Reference object out of box.I found it's already has been discussed in Q/A:
https://godotengine.org/qa/50783/get-class-name-as-string-from-class-reference
https://godotengine.org/qa/46057/how-to-get-the-class-name-of-a-custom-node
But still not implemented.
Of course it can be workarounded with custom variable or function. But it's would be much more convenient if it's will be awailable out of box.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Described above.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
For example through some property or function like get_custom_class()
If this enhancement will not be used often, can it be worked around with a few lines of script?
Yes, it's can be workarounded by custom variable like this:
or by custom function like this:
But that is tedious enough.
Is there a reason why this should be core and not an add-on in the asset library?
Beacause it's a GDScript core improvement
The text was updated successfully, but these errors were encountered: