Author Topic: Tween Restart Problem  (Read 3126 times)

konohira

  • Guest
Tween Restart Problem
« on: June 27, 2012, 05:12:58 AM »
Hi Aren,

I want to restart tween animation.
For that purpose, I write following codes.

  1. sprite.gameObject.SendMessage("Play", true);
  2. sprite.gameObject.SendMessage("Reset");
  3.  

But, a problem occurred.
Delay don't work of the second playing.
Delay is initalized by following code (in UITweener.cs)

  1. void Start ()
  2. {
  3.                 mStartTime = Time.realtimeSinceStartup + delay;
  4.                 Update();
  5. }
  6.  

"mStartTime" is not initialized with delay in second play.
Because, Start() is called only once.
Please fix this problem.
Sorry for my poor English.
Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tween Restart Problem
« Reply #1 on: June 27, 2012, 06:54:14 AM »
I originally thought the delay will only be used by people adding scripts in the inspector... seems I was wrong. :)

I'll fix it, thanks.

themipper

  • Guest
Re: Tween Restart Problem
« Reply #2 on: May 03, 2013, 06:31:25 PM »
Hello ArenMook,

It seems that this is not fixed in the current Version 2.5.1.

I fixed it by adding mStarted = false to the UITweener.Reset() method.

  1. public void Reset()
  2.         {
  3.             mStarted = false;
  4.             mFactor = (mAmountPerDelta < 0f) ? 1f : 0f;
  5.         Sample(mFactor, false);
  6.         }
  7.  

Cheers
themipper