Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: SquigglyFrog on July 11, 2014, 12:22:56 AM
-
Ok, I am still really new to NGUI and unity in general.. Currently I have a button inside a UIPanel.. it is anchored to the bottom left. Anchor type shows unified.. How can I change that anchorposition in c# to anchor it to the bottom right? Been trying for a bit and nothing seems to get that to move.. I could always create a separate duplicate button, but I know there has to be a better way to just move it to the other side of the screen...
-
widget.leftAnchor.Set(target, 1, -100); // <-- '1' means 'right', as 0 is 'left' and 0.5 is 'center'. -100 is the absolute offset -- 100 pixels.
You will need to set others as well (rightAnchor, topAnchor, bottomAnchor).
-
That could be where I was going wrong then, inputting wrong values in the set. Will give this a try once I get home. Hopefully that will take care of my issue. I'm assuming I will need to call reset and update anchors as well. One other question, target. Is this just my current gameobject or?
Appreciate the assistance!
-
Target is whatever you want this widget to be anchored to.