Author Topic: Cant change the UITweener delay by script !  (Read 2051 times)

Sahkan

  • Jr. Member
  • **
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 74
    • View Profile
Cant change the UITweener delay by script !
« 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 )
« Last Edit: June 10, 2014, 02:13:19 PM by Sahkan »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Cant change the UITweener delay by script !
« Reply #1 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?

Sahkan

  • Jr. Member
  • **
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: Cant change the UITweener delay by script !
« Reply #2 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 ) .
« Last Edit: June 11, 2014, 02:59:51 PM by Sahkan »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Cant change the UITweener delay by script !
« Reply #3 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.

Sahkan

  • Jr. Member
  • **
  • Thank You
  • -Given: 9
  • -Receive: 0
  • Posts: 74
    • View Profile
Re: Cant change the UITweener delay by script !
« Reply #4 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 ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Cant change the UITweener delay by script !
« Reply #5 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(...);