Godot Version
v4.4.dev5.official [9e6098432]
Question
Been dabbling in Godot for years and finally going to do something tangible with it…thought I understood the relationship between scenes, nodes and scripts but ran into some situations I never noticed before.
In my main scene, there’s a player node that has some signals, and a HUD I connected them to. All worked fine.
As I was iterating, I turned the HUD branch into a separate scene. All continued to work perfectly.
Was experimenting further and noticed that the HUD node in the main scene had the HUD script on it. If I opened the HUD scene itself, the HUD script was present on the root node as well.
Then, thinking I didn’t want it in “two” places, I deleted the script on the HUD node in the main scene. My thought being that any time I dragged the HUD child scene into a parent scene, I didn’t want to have to remember to assign the correct script to it. I later saw that Godot applies the root node script automatically, which is great…
…but I’m still allowed to remove or replace the script on the HUD node in the main scene. Is this something people do often–to replace or override behavior?
Also noticed that even though the root node of the HUD scene had signal handling methods defined, they wouldn’t appear in the signal inspector’s “pick and connect” dialog…unless that script was “also” present on the HUD node in the main scene. (Which I get happens automatically in the editor…unless some noob later removes it thinking they’re making things better smile)
I suppose I was expecting the child HUD scene’s root node script methods to still be “visible” in the signal connection dialog. Also expecting the root node’s script to appear in the main scene, but not be “editable/replaceable”…similar to how child nodes of a child scene aren’t visible unless you “enable children”. Or have a warning that you’re basically replacing the script that is already defined in the child scene.
I guess I’m not even sure what my question is other than wondering why this ability exists and if it’s used much, or if this is just some editor experience question.
A child scene is created with its encapsulated behavior–when it’s used, the editor automatically applies the child scene’s root node script correctly, but also allows it to be replaced or outright removed with no “are you sure you mean to do this?” warning?