SirLich, (edited )
@SirLich@mastodon.gamedev.place avatar

EDIT: This exists -check replies! :godot:

I wish Godot had inline scripts.

I find this most relevant with UI. For example a label that displays the name of the current level. I don't WANT to create and organize a separate .gd file for this. I want the script to just be owned by the node as part of the tscn file.

Cluttering the file system with one-off files that won't be reused doesn't feel the cleanest to me.

hellpie,
@hellpie@raru.re avatar

@SirLich you can check the "Built-in Script" checkbox. It will store the code of the script in the .tscn file itself. The internal editor handles them "magically", external editors struggle with them tho because they are just text in a scene and not an actual script file.

SirLich,
@SirLich@mastodon.gamedev.place avatar

Note: What I'm looking for is something like inline resources. Isn't it nice that you can create e.g., a LabelSettings inline, and aren't required to create a new .tres file for this resource?

Imagine if scripts worked the same way, and you would only need to save the external .gd file when you were ready to extract the code into something reusable.

You wouldn't even need to name these inline scripts. They're just... a property of the node.

tracefree,
@tracefree@mastodon.gamedev.place avatar

@SirLich I think this is pretty much what built-in scripts do. When adding a script to a node, check "built-in script" and the script gets saved in the tscn file

SirLich,
@SirLich@mastodon.gamedev.place avatar

@tracefree Uh no, I stepped right into this one, didn't I?

I've been using this software since 2016 and never learned this 😅

I am somewhat wondering what these "Limitations" could be (other than external editing I guess!). I will evaluate them and decide whether they're useful or not. I suppose a different icon might be nice...?

I will edit the original post if you don't mind, to avoid confusion.

tracefree,
@tracefree@mastodon.gamedev.place avatar

@SirLich Of course, hope this works well for you!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • godot
  • DreamBathrooms
  • ngwrru68w68
  • tester
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • InstantRegret
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • mdbf
  • tacticalgear
  • JUstTest
  • osvaldo12
  • normalnudes
  • cubers
  • cisconetworking
  • everett
  • GTA5RPClips
  • ethstaker
  • Leos
  • provamag3
  • anitta
  • modclub
  • megavids
  • lostlight
  • All magazines