Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: pad406 on June 20, 2014, 04:27:23 PM

Title: Problem getting tween working
Post by: pad406 on June 20, 2014, 04:27:23 PM
Trying to put a small demo together for my wife on something and it's really simple, but I can't get it to work. Have attached 2 images to make it easier to explain. Top part is some text, user can scroll up and down (all that works fine). Selecting one of the buttons then opens up some text (pushing down the other options). Then clicking on it again closes it up. Typical tween scale stuff. But for some reason it's now working for me, the text displays but it's behind the other buttons, they never move down the screen. I know I'm missing something real simple but I just can't spot it. 2nd image is the hierarchy from Unity. Any ideas anyone? TIA

Title: Re: Problem getting tween working
Post by: ArenMook on June 21, 2014, 03:31:51 PM
TweenScale has an option to update the table. You need to explicitly check that option in order for it to do so.
Title: Re: Problem getting tween working
Post by: pad406 on June 22, 2014, 07:49:26 AM
Thanks Aren, that did the job, don't know how I missed that one.

Just one other thing though, now everything looks perfectly lined until I run it, then the panel/table jumps up and to the left. Currently I have no anchors on it, I don't think I should need them in this case. But why is it just moving straight away?
Title: Re: Problem getting tween working
Post by: ArenMook on June 22, 2014, 11:24:08 PM
What's your scroll view's origin point?
Title: Re: Problem getting tween working
Post by: pad406 on June 23, 2014, 02:32:44 PM
Not sure what you mean by origin point? Where is that set? is it the transform position? If yes (I doubt it), no matter what I set that to the table moves to the same position.
Title: Re: Problem getting tween working
Post by: ArenMook on June 24, 2014, 04:43:50 AM
No.. it's set on the scroll view. The first parameter, "Content Origin".
Title: Re: Problem getting tween working
Post by: pad406 on June 24, 2014, 02:42:56 PM
It's set to TopRight and no matter what I set it still jumps to the right (not left as I said earlier). Have attached 3 screen shots. First is before I press play, then play with origin set as top left, 3rd with origin as top right. It's probably something silly or something I just don't understand but I'm lost!!

Title: Re: Problem getting tween working
Post by: ArenMook on June 25, 2014, 06:17:49 AM
Your content is TopLeft, not top right. And it's "jumping" there because if you look closely at your content outline (orange rectangle), it extends past your label. Figure out what's causing it to extend. You have some widget there that's far to the left of your label.

P.S. Why do you have a table there? Tween + table sounds like a bad combination for what you're doing. If you want those buttons to be below your text, just anchor them. Don't use a table.
Title: Re: Problem getting tween working
Post by: pad406 on June 25, 2014, 02:06:39 PM
Rushing last night, meant to put top left. The table is there for the tween scale so that they move to expand, as per your first answer. I'll have a look at the content area and try and figure out what's happening. Thanks.
Title: Re: Problem getting tween working
Post by: pad406 on June 25, 2014, 03:47:43 PM
Hi Aren

it seems to be snapping the text label to the top middle of the table (or maybe the panel) based on the way the pivot is set on the label. So if it's set as left justified you get what I posted earlier, but if I set the label as centered then it looks ok, it does move slightly but it's barely noticeable.  What causes this?
Title: Re: Problem getting tween working
Post by: ArenMook on June 26, 2014, 10:45:22 AM
The table expects to have all content use the same pivot points. So if you use top-left with the label, use top-left with the buttons too.

You can also try to get rid of the table. If you use anchors, you will still get the same effect with one widget being glued to another like you would with a table, but without the snapping.
Title: Re: Problem getting tween working
Post by: pad406 on June 27, 2014, 01:49:49 PM
Thanks, I seem to be getting there slowly. On the table, do I not need that as the button operates the tween that opens up and I want the subsequent buttons to move fown the screen
Title: Re: Problem getting tween working
Post by: ArenMook on June 27, 2014, 02:10:26 PM
Anchors set to update in "OnUpdate" will behave the same as a table in this regard. If the dimensions change, anchors will update accordingly.
Title: Re: Problem getting tween working
Post by: pad406 on June 27, 2014, 02:31:53 PM
Ok I'll try that so. It's a very good product, I'm sure I'll get my head around it eventually :)
Title: Re: Problem getting tween working
Post by: pad406 on June 27, 2014, 04:07:51 PM
Or maybe not! I tried removing the table. With no anchors set the text in the tween simply goes behind the buttons, as expected. Then I tired to set the top anchor on the 2nd button to the bottom of the 1st label and it all went a bit mad. The button jumped miles down the screen, and I mean miles. I presume that is what you meant by using the anchors
Title: Re: Problem getting tween working
Post by: pad406 on June 28, 2014, 08:53:35 AM
Ok, got it working using anchors at last. My problem eventually turned out to be the Y scale on the labels that were being tweened. With the table you don't need to initally set this to .01 on the transform, but when you are anchoring other objects to it, you do. Pretty obvious in hindsight. Not so much when you're doing it. :)