Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: jz87 on July 28, 2012, 12:29:18 AM
-
I'm trying to build a dialog box. I want to anchor a button to the top left of the dialog box. UIAnchor only allows me to anchor relative to the screen. Is there anyway to specify an object/bounding box to anchor to?
-
Phil is currently working on creating a built-in version of the community-created UIStick script that does what you want. In the meantime you will have to code that logic yourself -- but it's fairly trivial. Given the dimensions of the sprite (say, width), you can change the position accordingly. It's a 1 line of code inside an Update function.
-
I know this is an old thread, but did anything ever come of this? It would still be useful to have something like UIStick. I'm trying to do the same thing as jz87 wanted to do - build a dialog box from a UISlicedSprite (scaled by a UIStretch to take up a specific proportion of the screen regardless of resolution and aspect ration), and then arrange the text, buttons and other elements relative to that UISlicedSprite.
-
Yes, UIAnchor can be used to anchor to widgets now.
-
Doh! I completely missed that you could do that! It works a treat, thank you :D