Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Darkness on October 04, 2015, 07:23:39 PM

Title: Problem with TweenPosition
Post by: Darkness on October 04, 2015, 07:23:39 PM
So I have a little issue with TweenPosition.  For some reason when I call TweenPosition.PlayForward(), it moves the window, but it doesn't scroll.  It simply snaps to the new position without actually scrolling there.  If I turn on ping ponging or looping, it works, but a simple plug in the values and play won't actually scroll.  I have no idea why it won't actually scroll, but perhaps someone can provide an answer.

I'm happy it moves, but I would like the scrolling since it'll look better than the window just jumping to the next spot.
Title: Re: Problem with TweenPosition
Post by: ArenMook on October 07, 2015, 07:44:16 PM
I don't quite follow you here... tween position simply tweens some object's position from A to B over desired time. What scrolling are you talking about? What are you trying to scroll? Do you mean "interpolate" instead of "scroll"? Calling PlayForward() will start playing the tween from its starting position to the end. Try a simple scene with a tween on an object (make sure to disable it so it doesn't play automatically), then add a button that will call the tween's PlayForward() function in its OnClick.
Title: Re: Problem with TweenPosition
Post by: Darkness on October 07, 2015, 10:05:42 PM
I don't quite follow you here... tween position simply tweens some object's position from A to B over desired time. What scrolling are you talking about? What are you trying to scroll? Do you mean "interpolate" instead of "scroll"? Calling PlayForward() will start playing the tween from its starting position to the end. Try a simple scene with a tween on an object (make sure to disable it so it doesn't play automatically), then add a button that will call the tween's PlayForward() function in its OnClick.

Hmmm...  I think I didn't describe this right.  Put it simply...I want to tween the position from A to B over 1.25 seconds.  However, it doesn't tween...it just moves it to the spot when I play the animation.  There's no tweening going on.  It works in other instances, however, in this one it only works if I ping-pong or loop the animation.  Which isn't good.  Just not sure why it doesn't move from A to B over time.  It only moves from A to B immediately.

Hopefully that makes more sense.  I've got moving windows and elements all over my UI, so I know how it works.  It just doesn't work in this instance.  Wondering what would cause that behavior.  Is there a limit to how many objects can be moving at a time?
Title: Re: Problem with TweenPosition
Post by: ArenMook on October 10, 2015, 11:05:53 PM
When does the tween occur? Is it right after you hit Play? Unity has a fairly long freeze on start when you hit Play as it initializes everything, usually skipping some time as a result -- which varies with your computer's performance and the project's complexity. You can test it easily by disabling the tween, hitting Play, then enabling the tween while the game is playing.

You can also try it in a new scene -- add a sprite, put a tween position on it, move it, hit Play.
Title: Re: Problem with TweenPosition
Post by: Darkness on October 11, 2015, 12:05:00 AM
Well, it's not at the beginning of the project.  When the player gets a new item, a box slides on the screen telling the player that they got an item.  The box slides on the screen fine.  However, when I want to slide it off, it doesn't slide...it just instantly moves to the spot.  I guess it still does what it needs to do, but it's rather jarring since it doesn't tween and just magically ends up in the spot.  I'd like to get it to tween, but I'm not sure why it won't do it.

Originally, I thought that I needed to wait some time after the tweenposition.playforward() call was made, but changing the delay time didn't change anything.  The windows still wouldn't tween...just instantly move to their positions.  Any idea why this would be happening?
Title: Re: Problem with TweenPosition
Post by: ArenMook on October 12, 2015, 10:57:40 PM
Not off the top of my head, no. Try the new scene test I suggested and when that works properly start adding Debug.Log statements to the tweener to see what values it gets called/updated with.