Welcome,
Guest
. Please
login
or
register
.
May 04, 2026, 12:06:06 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
TweenPosition.PlayForward() not animating.
« previous
next »
Print
Pages: [
1
]
Author
Topic: TweenPosition.PlayForward() not animating. (Read 3314 times)
falantar
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 2
TweenPosition.PlayForward() not animating.
«
on:
January 24, 2014, 03:03:49 PM »
I have a tween position script attached to a bar that basically follows the color on the color wheel that you've selected. All it's supposed to do is slide up and down, I got it to work earlier with Mathf.Lerp but I've decided to take the NGUI approach and just change the To and From Vectors when each color is pressed. The bar goes to the right position but it doesn't animate, it's instant. I can't seem to figure out why, the time is set properly and so is the curve. What could be causing this?
Here's the code:
//Slide the selector bar
TweenPosition tp
=
colorScrollSpy
.
GetComponent
<
TweenPosition
>
(
)
;
Vector3 tempVec
=
GameObject
.
Find
(
currentColor
)
.
gameObject
.
transform
.
localPosition
;
Vector3 currentVec
=
colorScrollSpy
.
transform
.
localPosition
;
tp
.
from
=
currentVec
;
tp
.
to
=
new
Vector3
(
currentVec
.
x
, tempVec
.
y
, currentVec
.
z
)
;
tp
.
duration
=
0
.
5f
;
tp
.
PlayForward
(
)
;
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: TweenPosition.PlayForward() not animating.
«
Reply #1 on:
January 24, 2014, 11:54:51 PM »
You should use TweenPosition.Begin to activate tweens via code (doing so also creates a tween if it's not present), and there is no need to set the "from" position. The tween automatically uses the current position as its "from" point.
Logged
falantar
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 2
Re: TweenPosition.PlayForward() not animating.
«
Reply #2 on:
January 27, 2014, 12:41:23 PM »
Thanks, that's good to know! Also, fixed my problem. It was my fault, forgot to comment out a line of code I used for debugging.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
TweenPosition.PlayForward() not animating.