• Godot Help
  • why my buttons added with script dont appaear in game?

func create_item_menu():
	for key in get_node("/root/GlobalNode").get("items"):
		num +=1
		snum= str(num)
		namenode = "but" + snum
		add_child(Button.new(), true)
		get_child(num - 1).set_name(namenode)
		get_child(num - 1).set_position(get_node("/root/Node2D/Buttontelefono").get_position() + Vector2(0, (25 *num)))
		get_child(num - 1).set_size(get_node("/root/Node2D/Buttontelefono").get_size(), false)
		get_child(num - 1).set_scale(Vector2 (1, 1))

i know they exist in code because if i print information about they, it apparears (in salida/exit)but not in the gaming !

i know the nodes have been created, but still they dont apparear in game where they should.

While the game is running, use the Remote tab in the Scene dock to verify that the buttons are in the scene. When one of them is selected, you can check its properties in the Inspector.

    I wouldn't keep "getting" the button. Once you create the button you can set the attributes to it directly like so:

                    var b = Button.new()
    		add_child(b)
                    b.set_name(namenode)
    		
    		b.set_position(get_node("/root/Node2D/Buttontelefono").get_position() + Vector2(0, (25 *num)))
    		b.set_size(get_node("/root/Node2D/Buttontelefono").get_size(), false)
    		b.set_scale(Vector2 (1, 1))

    DaveTheCoder. Dont know whre is. Can you post a image with a arrow or a square please?

    i managed to do what i wanted changing "set_position" to "set_global_position". i had to make some others changes for put they in place.

    i have the buttons there.