Loading a scene with two or more sub-scenes gives null. A bug?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By z80

Hello!
The scene is a GUI scene with two buttons in HBoxContainer. But the buttons themselves are sub-scenes of one and the same type

HBoxContainer
|- ButtonA
|- ButtonB

This scene can not be loaded using load() or preload(). Null is returned. And this type of Null is destructive for other code following the load() line, see GDscript strange behavior. A bug? - Archive - Godot Forum

Such a scene can only be shown using F6 or being a part of an autorun scene.

But if I remove either one of the buttons.

HBoxContainer
|- ButtonA

Now it can be loaded no problem. What is it? A bug or a feature? How can I load a scene dynamically with more than one subscene?

Godot version is 3.2.2 built from source.

If you close the scene, make a backup of that scene and reopen it does it show any parsing errors?

Magso | 2020-09-07 09:58

I cannot reproduce it on my end. Could you share a minimal project where you see the problem?
Im correctly loading scenes many instanced scenes, and with many children node, without any problem.

p7f | 2020-09-07 12:32

Well, the problem is I don’t know how to paste any files here.

I’ve posted the same issue with the scenes causing the problem in Godot bug tracker. I’m sorry I should have done that in the first place.

The URL is the following: HBoxContainer with 2 or more identical subscenes can't be load()-ed or preload()-ed. · Issue #41834 · godotengine/godot · GitHub

z80 | 2020-09-07 22:30