godot-docs icon indicating copy to clipboard operation
godot-docs copied to clipboard

New default "Attach Node Script" path causes warning not mentioned in tutorial

Open codingthat opened this issue 1 year ago • 5 comments
trafficstars

Your Godot version: 4.2.2

Issue description:

Tutorial has:

Change the Template field from "Node: Default" to "Object: Empty" to start with a clean file. Leave the other options set to their default values and click the Create button to create the script.

existing screenshot

What actually happens:

Screenshot at 2024-07-29 18-24-06

URL to the documentation page: https://docs.godotengine.org/en/stable/getting_started/step_by_step/scripting_first_script.html#creating-a-new-script

It's not clear why the name defaults to res://Sprite2D.gd but if you change it to sprite_2d to match the tutorial screenshot, the result is pretty close (except the last line, "Template: ...," is now grey instead of green). But the tutorial says, "Leave the other options set to their default values."

So...should the default behaviour of Godot be reverted since it causes a warning, or should the tutorial instructions be updated?

If the latter, maybe the warning could be explained. It's not clear why exactly it's "usually not desired" nor in what case it might actually be desired despite the warning.

Thanks team, you're awesome :heart:

codingthat avatar Jul 29 '24 16:07 codingthat

It isn't applicable, because that warning is t there when you name the file sprite_2d.gd, you named it Sprite2D.gd which is different, the difference is due to the specifics with the naming, but the assumption is that you named it as instructed, not the default name, note how the rest of the tutorial uses sprite_2d.gd, so the change would be to bite this in the 4.2 docs specifically, in 4.3 this works perfectly right

AThousandShips avatar Jul 29 '24 16:07 AThousandShips

@AThousandShips I didn't name it that, though—it came up as the default. Oddly, though, I can't seem to reproduce it now. Attaching scripts creates a snake_case name rather than what I saw when I initially reported this. :shrug:

codingthat avatar Jul 29 '24 18:07 codingthat

@AThousandShips Actually, I can reproduce it, if I start a new project as instructed. Where I couldn't reproduce it was on some other project I'm now working on. If I start new, add other, use Sprite2D, (optionally) put icon.svg as the texture, then right-click and Attach Script, the default is what I reported.

codingthat avatar Jul 29 '24 18:07 codingthat

codingthat is correct. The docs should specify changing the name but right now they make it seem like you should use the default name that's generated.

skyace65 avatar Aug 12 '24 02:08 skyace65

Thanks @skyace65 . And perhaps more to the point, why does Godot sometimes default to snake_case and other times default to PascalCase?

codingthat avatar Aug 12 '24 07:08 codingthat