0 votes

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 = ButtonGroup.new()
        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])
            button.group = group
            item.get_child(1).text = image_names[0][i][j].capitalize()
Godot version 3.2.3.stable.official
in Engine by (7,166 points)

1 Answer

0 votes
Best answer

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

by (9,694 points)
selected by

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.