Support => NGUI 3 Support => Topic started by: harrisonpink on August 02, 2014, 08:25:53 PM
Title: change UIAnchor in script
Post by: harrisonpink on August 02, 2014, 08:25:53 PM
Hey guys, I've searched everywhere for an answer, but have had no luck.
I've got an object with the following Anchor properties:
Target: UI Root Left: Target's Left + 26 Right: Target's Left + 46 Bottom: Target's Top - 139 Bottom: Target's Top - 119
What I'd like to do is change this in script to:
Target: UI Root Left: Target's Right - 46 Right: Target's Right - 26 Bottom: Target's Top - 139 Bottom: Target's Top - 119
However, I'm trying to understand the Side and pixelOffset settings with no luck. Can anyone help?
Title: Re: change UIAnchor in script
Post by: ArenMook on August 03, 2014, 09:36:10 AM
What side and pixel offset settings? I'm not sure what you're referring to or how they relate to what you're trying to do.
widget.leftAnchor.relative=1;// 0 = left, 1 = right
widget.leftAnchor.absolute=-46;
widget.rightAnchor.relative=1;
widget.rightAnchor.absolute=-26;
widget.ResetAndUpdateAnchors();
Title: Re: change UIAnchor in script
Post by: harrisonpink on August 03, 2014, 09:17:13 PM
I'm sorry, I don't quite understand what you're asking me. The sides are described above I thought? I've attached some images to help explain what I want to do.
I've tried coding something like this in c# as described here http://tasharen.com/ngui/docs/class_u_i_anchor.html (http://tasharen.com/ngui/docs/class_u_i_anchor.html) but it hasn't worked.