Author Topic: Bug - Tweens  (Read 3270 times)

BehemothPro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Bug - Tweens
« on: January 22, 2014, 03:45:51 PM »
I have a UILabel that uses a TweenPosition to scroll the text from the right side of the screen to the left. It has ignore Time Scale checked and when the tween is finished a function is called that moves it to the right side of the screen again and starts the tween again so it loops from right to left forever. It works fine until the application is suspended.

After the app is paused and I return to the game after about 1 minute, and I get a stackoverflow exception. It seems to be calling my OnFinished function many times. On my side, this can be fixed by unchecking ignoreTimeScale, but I want the text to continue moving in game even if timescale is 0. So I don't think the Tweens should be moving or simulate that it has moved by time while the Application is Paused.

Is there another way I'm suppose to do this with Tweens or should I just stay away from Tweens altogether?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Bug - Tweens
« Reply #1 on: January 22, 2014, 09:34:27 PM »
Hmm. Curious. I'm guessing RealTime.deltaTime becomes a huge number. Change RealTime.Update to this:
  1.         void Update ()
  2.         {
  3.                 float rt = Time.realtimeSinceStartup;
  4.                 mRealDelta = Mathf.Clamp01(rt - mRealTime);
  5.                 mRealTime = rt;
  6.         }

BehemothPro

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Bug - Tweens
« Reply #2 on: January 23, 2014, 01:17:16 PM »
Yes, Thank you! That fixed the issue.