This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes
    add_child(chestInterface.instance())
    chestList = get_node("ChestInterface/ChestInterfaceChild/ScrollContainer/ChestList")

    for itemName in inventory:
        print(itemName)
        var item = inventoryItem.instance()
        item.text = itemName
        chestList.add_child(item)
    print(chestList.get_children())

The nodes printed in the last row are the correct ones so they do get added but they're not visible in the game. The script is tied to the position2d near the bottom of the main scene tree

This is the chestInterface scene tree

Heres the main scene tree. The chestInterface gets added as a child to the position2d near the bottom

github link: https://github.com/N0nken/Godot-project

Godot version stable mono 3.4.4
in Engine by (49 points)
edited by

1 Answer

0 votes
Best answer

Control nodes ( green ) do not inherit position of 2dNodes ( blue ). This is because Node2d uses position/globalposition, while Control uses rectposition. You should manually do it like :

ChestInterfaceChild.global_rect_position = ChestInterface.global_position

If You mean, that the control children of control parent are invisible, than You surely forgot to set minimal size of children. If it is 0, it will shrink to scale 0.

by (8,188 points)
selected by

with "minimal size of children" do you mean the rectminsize property? Because it says that if its set to (0, 0) then it'll automatically scale to fit the children.

nvn i solved it by copying my working player inventorys nodes dont know why it fixed it though

Because it says that if its set to (0, 0) then it'll automatically scale to fit the children.

That is only true when child control has behavior set to expand. And You don't want that, because it would expand and take whole place

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 Frequently asked questions and 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 [email protected] with your username.