Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: konohira on June 27, 2012, 05:12:58 AM

Title: Tween Restart Problem
Post by: konohira 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.
Title: Re: Tween Restart Problem
Post by: ArenMook 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.
Title: Re: Tween Restart Problem
Post by: themipper 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