Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Sahkan on June 10, 2014, 01:29:43 PM

Title: Cant change the UITweener delay by script !
Post by: Sahkan on June 10, 2014, 01:29:43 PM
Take this line for example :

playerMinusSign.GetComponent<TweenPosition>().delay = sixthDelayInner

when, running i can see the value change in the box on the inspector, but the tween itself wont change, only if i enter the value manually it will change, why is that ?

On NGUI 3.5.3 ( Cant update, workPlace wanna use this version )
Title: Re: Cant change the UITweener delay by script !
Post by: ArenMook on June 11, 2014, 04:44:53 AM
I'm not sure what you mean. If the value changes in the inspector, then it obviously changes. Where else should it change?
Title: Re: Cant change the UITweener delay by script !
Post by: Sahkan on June 11, 2014, 11:35:01 AM
If let's say the valueBox has the value 1 in it and i enter in 10 inside of it (in the inspector), the tween will start 10 seconds after the game is started right ? koo .

Now let's have the same scenario with me changing the "delay" variable by script like i'v showed in the beginning of this thread.

While looking in the inspector, the valueBox shows 10, however, when i start the game, the tweenAnimation will start 1 second after the game has started ( just like it is ignoring the new value and considering the value that was there before the script rewrote the value ) .
Title: Re: Cant change the UITweener delay by script !
Post by: ArenMook on June 12, 2014, 02:02:00 AM
That's a starting value. Once the tween begins, changing it will have no effect. You need to actually re-start the tween for this kind of change to take effect.
Title: Re: Cant change the UITweener delay by script !
Post by: Sahkan on June 12, 2014, 12:48:30 PM
That's a starting value. Once the tween begins, changing it will have no effect. You need to actually re-start the tween for this kind of change to take effect.

I found an other solution to what i'v wanted to do, but i guess it will work if i just enabled=false and enabled = true ?
Title: Re: Cant change the UITweener delay by script !
Post by: ArenMook on June 13, 2014, 04:32:23 AM
No, you restart a tween by calling its PlayForward or PlayReverse functions.

Although it's generally better to use the Begin method, such as TweenPosition.Begin(...);