Hi there,
Just wondering if this is possible or if there is an alternative.
In my vertical box I have 3 buttons. Let’s say they are named 1, 2 & 3 (top, middle & bottom.)
If I click button 1, I want it to move to the position of 2, and 2 to move up to where 1 came from.
If I click button 3, I want it to move to the position of 2, and 2 to move down to where 3 came from.
If I click button 2, it doesn’t move.
Any ideas?
I can’t think of an easy way around this, nor can I think of a good use case for this example, but here’s two ideas that could help you achieve your goal.
- Child manipulation
Clear the children of the vertical box and add children in the desired order on click.
- Transform
Manipulate the transform pivot of the individual buttons in the vertical box
I think I may use child manipulation as transforming looks like tedious for how many buttons I actually use.
Thanks for the answer!
So I used clear children to clear the buttons and then re-draw them one by one using add children. They successfully display in the new order however the sizes and dimensions become strange and different from the original layout.
Any ideas?
I managed to figure it out with tinkering.
I clear the children of the vertical box (This can apply for horizontal box also).
I add child keeping the target as the vertical box and the content as the button I want to fix alignment for.
I then set horizontal and vertical box alignment using the button as a target.
The reason I had to do this in the first place was because when you clear children from a horizontal/vertical box, the alignment settings seem to default back to Left and Top.
Potential bug and also potential bug fix.