Added children not visible in game view

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nonken
    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

:bust_in_silhouette: Reply From: Inces

Control nodes ( green ) do not inherit position of 2dNodes ( blue ). This is because Node2d uses position/global_position, while Control uses rect_position. 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.

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

Nonken | 2022-08-05 14:12

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

Nonken | 2022-08-05 16:11

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

Inces | 2022-08-05 18:34