Nodes instanced through code not showing up

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

I have two preloaded scenes. I instance them through code and they are added as children. But they don’t show up! I printed out a bunch of stuff, and they exist, and apparently are visible (at least, visible = true) and their position is (0, 0), but they’re not offscreen. So where are they???
Also, when I created the nodes through code instead of preloading scenes they showed up (I changed to preloading scenes to make the code simpler).
Here is the relevant code:

const ScrollClass = preload("res://scenes_and_scripts/scenes/OptionScroll.tscn")
const ItemClass = preload("res://scenes_and_scripts/scenes/Item.tscn")
# Code cut out here
# Makes all of the icons for the options and then hides the ones not in use
func make_icons():
	for i in range(len(images[0])): # Loops through front view images
		var scroll = ScrollClass.instance()
		var item = ItemClass.instance()
		item.get_child(0).connect("pressed", self, "remove_cur_option")
		item.get_child(0).disabled = false # I have to re-enable the button since it's disabled by default
		var group =
		for j in range(len(images[0][i])):
			item = ItemClass.instance()
			var button = item.get_child(0)
			button.texture_normal = images[0][i][j]
			button.connect("gui_input", self, "on_item_pressed", [button, j]) = group
			item.get_child(1).text = image_names[0][i][j].capitalize()
:bust_in_silhouette: Reply From: volzhs

You can easily inspect what is going on your running scene by Scene dock > Remote tab.
Try this Remote tab in Scene dock.

Thanks, I didn’t know about that. Apparently the nodes were being added as children to the horizontal scroll bar of the scrollcontainer. I have no idea why this happens since the gridcontainer was still listed above it in the node tree.

exuin | 2021-01-20 18:23