In-built scripts

Godot Version

v4.2.1.stable.official [b09f793f5]

Question

I’m trying to organize my project tree better, including various GDScripts.

Up until now I was saving GDScript files either in the same directory as the scene they work on, or in a dedicated folder, or in thematic folders (Enemy, Collisions…) or in some other way, but no matter what, there are always so many of them that it ends up messy or is hard to maintain etc.

And if I just want to test something out real quick and then forget to delete the accompanying script, it’s unpleasant having to dealing with orphaned scripts if I forget what did it belong to. In short it’s all very impractical.

Also, in my case a script is very rarely directly used by multiple scenes so I might as well “tie them” to a particular scene.

So, reading about in-built GDScripts sounds like what I’m looking for!

But for some reason I never see them mentioned, at least where I’m looking, for example I can’t remember ever seeing them mentioned in a tutorial (and I watched tons of them). I found some basic info about them online but it’s pretty old. I assume they have some downsides (in 2019 it was not possible to register a class within a built-in script according to a forum post here but ok, not a big problem link and there are some downsides mentioned elsewhere on Reddit) but so far I haven’t really seen any arguments against using them as the default for scripting in my case.

So, is there a reason no one is ever talking about built-in scripts?
And if there are people here that do use them: any gotchas I should be aware of in 2024 when using built-in scripts?

I’m not sure if built-in scripts are still a thing in Godot 4.x, but if they are they’re very well hidden.

That said, I imagine one advantage they’d offer is encapsulating everything in a single file, which would make the file-system a little tidier.

For all my scenes with scripts, the script files sit next to the scene file (e.g. ghost.gd below). If a script is shared by more than one scene I put them in a parent folder (e.g. enemy.gd and moving_actor.gd). And if a script is shared in lots of places, I put it in my /scripts folder. Seems to keep things tidy enough for me, so I don’t really miss built-in scripts.