When you use the Ugui. It is often necessary to dynamically change the value of Recttransform,
When you select a different layout. You'll find that the values here are different.
Some left,botom. or Posx posy.
When you want to change, you pass the corresponding attribute value.
U3d settings for Recttransform Some parameters of the new UI system Ugui
Unity has a UI system that works better than before, but it's also new to the recttransform,posx,posy .... You may not know how to change the code at first, but after a lot of experimentation you will understand something:
1. Change the top of Recttransform
Getcomponent<recttransform> (). Offsetmax = new Vector2 (getcomponent<recttransform> (). offsetMax.x, top);
2. Change the bottom of recttransform
Getcomponent<recttransform> (). offsetmin = new Vector2 (getcomponent<recttransform> (). OffsetMin.x, bottom);
3. Change the width,height of Recttransform
Getcomponent<recttransform> (). Sizedelta = new Vector2 (width, height);
4. Change the pos of Recttransform
Getcomponent<recttransform> (). anchoredposition3d = new Vector3 (Posx,posy,posz);
Getcomponent<recttransform> (). anchoredposition = new Vector2 (posx,posy);
Modifying the value of a recttransform