hy guy ,
I am trying to creat a dynamic panel with buttons.
The problem is the button didn t take the positon that i set to it in the code like you can see on pictures.
I am trying to instantiate a button in (50,60,0) in localposition for the “PanelConstrctionVille” but the button go to (130 , 152 , 0).
I Have tested the good position ( vector3 (50, 60, 0)) with a button in the scene as children panel ( the blue button on the capture => name = Button(1).
Why the “transform.localposition” didn t work ?
Thx for help !
transform.localPosition is the transform’s position relative to its parent. So if it’s parent is at the position (100, 100) and you set it’s localposition to (50, 50), then its actual position will be (150, 150). If you want to set its position independent of the parent’s position, then use transform.position.
I want my button get a relative position to his parent. the correct position based on parent is (50,60,0).
My Panel have this position (0,-20,0). How my position can be (130,152,0) .
Regarding what u said , the position shoud be (50,60,0) + (0,-20,0) = (50,40,0) and not (130,152,0).
Maybe do i understanding something wrong ?