1
NGUI 3 Support / [BUG] Anchoring to widgets that has a parent
« on: August 17, 2012, 02:03:33 AM »
Hi I've notice a pretty annoying bug, which I hope you can resolve for next NGUI patch.
I want to anchor different groups of widgets to each other and thought of the following solution, but it bugs.
Let say I have a Empty GameObject as a parent and under it I have a BackgroundWidget, a LabelWidget and a IconWidget. Since I want those widget to stick together its of course nice to have a parent for them so I can move them around together.
Now to the issue. I have another Empty GameObject Parent, with similar/other Widgets as childs and want to anchor the second gameobject parent (and all its widgets) under the first one. To be able to anchor the second game object parent under the first group of objects I need to know the size. Since the BackgroundWidget covers all the widgets, this is perfect to anchor too. So I put my Anchor Script to the Second Empty GameObject Parent and link it to the BackgroundWidget (slicedsprite) in the first group of gameobjects.
Now that should work perfectly I hoped, but the anchoring is totally messed up. It doesn't take the parents position into consideration, so anchoring only work for gameobjects that has the same parent. If I move the first Parent around the second group of gameobjects doesn't move even if they are anchor to the backgroundwidget (which changes position when I move the parent) becuase the localposition of the background widget stays the same. The position on the anchored group only changes if I change the localposition on the backgroundWidget and not the parent position.
I hope you understand the issue. Thanks
I want to anchor different groups of widgets to each other and thought of the following solution, but it bugs.
Let say I have a Empty GameObject as a parent and under it I have a BackgroundWidget, a LabelWidget and a IconWidget. Since I want those widget to stick together its of course nice to have a parent for them so I can move them around together.
Now to the issue. I have another Empty GameObject Parent, with similar/other Widgets as childs and want to anchor the second gameobject parent (and all its widgets) under the first one. To be able to anchor the second game object parent under the first group of objects I need to know the size. Since the BackgroundWidget covers all the widgets, this is perfect to anchor too. So I put my Anchor Script to the Second Empty GameObject Parent and link it to the BackgroundWidget (slicedsprite) in the first group of gameobjects.
Now that should work perfectly I hoped, but the anchoring is totally messed up. It doesn't take the parents position into consideration, so anchoring only work for gameobjects that has the same parent. If I move the first Parent around the second group of gameobjects doesn't move even if they are anchor to the backgroundwidget (which changes position when I move the parent) becuase the localposition of the background widget stays the same. The position on the anchored group only changes if I change the localposition on the backgroundWidget and not the parent position.
I hope you understand the issue. Thanks