Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: 6foot3foot on September 24, 2013, 04:05:01 PM
-
I've tried with a,b,c,d the anchoring of my labels doesn't not line up at all with the widget parent.
A simple case is having a sprite background, and a label on top. Setting the anchor to centre puts the image off to the far side, or sometimes the middle of the screen (yes the widget is set). Tried with many different shapes / anchor types, maybe the changes in anchoring in 3.0 is more than I thought. But I'd think if I anchor Widget A to Widget B and tell it to be 'right' it would neighbor up (setting the pivots correctly of course). Or even have it center pivot, and then center within the other widget. I'm just not seeing those results, leaving me to hand position everything, which is hard when supporting XXTeen resolutions for mobile.
-
As what I'm saying is probably hard to understand from reading. Here's a simple way I can reproduce it.
Have a Sprite Widget, and a Label Widget.
1) Set Sprite pos to 0,0,0 Label somewhere else.
2) Add the anchor to the label, and have the sprite be the container widget.
3) Center the label to the sprite using the pivot / center anchor ( should work as expected)
4) Now, Move the sprite in a X or Y movement
--- This is where I see the issue, the label doesn't stay centered in the sprite container anymore, it pretty much stays still.
-
The widgets need to be siblings for them to anchor properly. I mention that in the video tutorial.
-
Correct, unless I'm 'sibling' them wrong. But the label is a child. I've attached screenshots to show the problem I see, it's that after I anchor and move the parent the child loses it's connection.
-
Sibling = next to each other in the hierarchy. A child is not a sibling. :P
-
6foot3foot, I was having the same troubles and even the sibling doesnt work correctly. Still with your label as a child of the sprite. With your steps above, just place a panel on your sprite and you should be set.
-
Ok, I've tried with them not as children, and just lined up in the hierarchy, but will keep mucking with it.
Corwar: Setting it as a panel does work, the problem is we are introducing new draw calls for each panel added (as far as I am able to understand how the panels / draws work), so when I have 100 table items it becomes expensive. with 2.x the anchoring seemed to work as expected, but I'm sure the overhaul has just changed a lot of workflows, i'll revisit the new videos and spend time chasing this down.