Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: whilesocold on July 19, 2015, 06:11:02 AM

Title: How to set anchors through code?
Post by: whilesocold on July 19, 2015, 06:11:02 AM
Hi, can you help me to get coords for setting anchor through code, like on attached image?
Best regards.
Title: Re: How to set anchors through code?
Post by: ArenMook on July 21, 2015, 11:32:08 AM
For example:

widget.topAnchor.Set(1f, -162f);

...where "1f" means "top" in this case (0f would be bottom, 0.5f would be center, etc).

So the code above effectively means "take the target's top and subtract 162 to get the top anchor's position".