Skip to content
New issue

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

When creating a new script, Class Name is always "N/A" preventing auto-generation of class_name #75071

Closed
hsandt opened this issue Mar 18, 2023 · 3 comments · Fixed by #78573
Closed

Comments

@hsandt
Copy link
Contributor

hsandt commented Mar 18, 2023

Godot version

v4.0.stable.official [92bee43]

System information

Linux Ubuntu 22.04 with Unity desktop

Issue description

I always have to write my class_name myself, so I thought a setting to auto-generate class name from the script file name, or at least to manually input it at script file creation, would be nice.

I found the field I wanted in the Create Script popup as "Class Name", except the content is filled with N/A no matter what. It doesn't auto-fill from file name, and I cannot edit the field manually either.

I'm using Godot without C#. Is it only active in C#? Either way, it is still useful in GDScript to auto-fill class_name at the top.

image

First I'd like to see the expected behavior... If it's only meant for manual fill, then once it's fixed, I will submit a suggestion to go further and auto-fill from file name.

And forgive me if it was already reported. Turns out that searching "N/A" is super hard when so many issues set "Minimal reproduction project" as "N/A"... including this one!

Steps to reproduce

  1. Create a new script
  2. In the Create Script popup, note how Class Name is "N/A".
  3. Try to edit the field, to no avail.
  4. Edit the path, but Class Name is still not updated.

Minimal reproduction project

N/A

@Calinou
Copy link
Member

Calinou commented Mar 21, 2023

I'm using Godot without C#. Is it only active in C#? Either way, it is still useful in GDScript to auto-fill class_name at the top.

Indeed, this field is only used in C#. It could be made usable from GDScript too, with the default value (empty string) resulting in no class name.

I wouldn't do automatic class_name generation though, as having too many class names tends to cause issues. For instance, GDScript lacks namespaces, and having lots of class_names can decrease editor performance. As a result, you should only create named classes in GDScript when you actually need them.

@hsandt
Copy link
Contributor Author

hsandt commented Mar 22, 2023

OK, so in this case, just a toggle to enable class_name generation, or considering empty as no class_name and filling something as defining a custom class_name, would work.

Sounds like it would be a totally different field than for C#. Should it become a proposal then?

@Calinou
Copy link
Member

Calinou commented Mar 22, 2023

Sounds like it would be a totally different field than for C#. Should it become a proposal then?

I'd prefer it being the same field, just with the field's default value changing depending on the currently selected language (and empty values being allowed in GDScript).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants