if the button dont appears anyways, try put a position in the button.
extends Button
var arg=[]
func ready():
arg.resize(76)
for i in range(arg.size()):
var button = Button.new()
$Button.add_child(button)
button.set_size(Vector2(64,64))
button.visible=true
button.connect("pressed", self, "myrotate", [i])
$button["custom_styles/normal"].bg_color = Color("#bada55")
button.show()
arg.insert(i, button)
arg[0].set_position(Vector2(192,64))
arg[1].set_position(Vector2(256,64))
I tried what you said, it still isn’t showing. Maybe I missunderstood you. Is it supposed to be like this? I cut out the code with positions of the buttons. Each one of them had a position.
For anyone having the same problem, you shouldn’t add button as a child of another button. Add it as a child of a control node. There are some minor syntax mistakes also in my code. So here is how it looks now, it still has problems like rotating it, but visibility is ok.
extends Control
var arg=[]
func _ready():
arg.resize(76)
for i in range(arg.size()):
var button = TextureButton.new()
button.set_rotation_degrees(0)
button.set_size(Vector2(64,64))
button.texture_normal = load("res://cijev.png");
button.connect("pressed", self, "myrotate", [i])
arg.insert(i, button)
add_child(arg[i])
setposition(i)