Reputation: 14141
I have a form and I want to shift the inputs/children of the form down to show an error message when needed.
I can loop over the children and I just want to shift then each down 20 pixels which are about the height of the error text but the input moves about 3000 down the x-axis. I am sure it is going to be obvious what I am doing wrong.
foreach (Transform child in Form.transform)
{
Vector3 p = child.position;
Debug.Log(child.name);
p.x += 20f;
child.position = p;
}
Upvotes: 1
Views: 48
Reputation: 16662
Here's an alternative approach:
Text
or whateverThe layout system will take care of shifting all elements positions for you.
Upvotes: 2