Author Topic: Tweens Logically Finishing but Not Visually Completing  (Read 14274 times)

NaxIonz

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 70
    • View Profile
Tweens Logically Finishing but Not Visually Completing
« on: April 24, 2015, 11:52:02 AM »
So, I have an issue, that usually only occurs on devices, and usually lower end ones (but very occasionally on decent ones).

Logically, as far as the variables are concerned, the tween has finished. If I try to log the values of what is going on under the hood, the tween thinks it did it's job. However, on screen, not so much.

For example, I have some popups that do one of two things. One of them, when it is shown it tweens in from off screen. So it descends from above, and then does a slight bounce and rests in the center of the screen. But sometimes, the popup doesn't visually make it all the way down. It's just stuck half way on the screen. If I turn the screen off/on, then it is in the correct place. Mind you, I run no logic or code for OnApplicationPause/Resume that would affect positions at all. And also note, that I have even logged the variables.

I am seeing similar behavior with a new project, but these popups do a scale from 0=>1, but sometimes, for some reason, they only make it half  way, and just appear on screen at about 0.25f instead of 1.0f.

Has anyone ever experienced this before?
Does my description make sense?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tweens Logically Finishing but Not Visually Completing
« Reply #1 on: April 27, 2015, 04:24:23 PM »
Scale of 0 is invalid. You can't divide by zero.

NaxIonz

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 70
    • View Profile
Re: Tweens Logically Finishing but Not Visually Completing
« Reply #2 on: April 30, 2015, 12:28:15 PM »
I'm a bit confused then why it works 95% of the time.

But in any case, These should start at 0.01 and scale to 1.0f?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tweens Logically Finishing but Not Visually Completing
« Reply #3 on: April 30, 2015, 08:34:44 PM »
0.01 is fine.

NaxIonz

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 70
    • View Profile
Re: Tweens Logically Finishing but Not Visually Completing
« Reply #4 on: May 05, 2015, 11:25:20 AM »
0.01 is fine.

So, we changed all the tweens to start at 0.01f instead of 0.0f, and we still get the issue where sometimes the tween does not visually complete.

Any other thoughts/ideas?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tweens Logically Finishing but Not Visually Completing
« Reply #5 on: May 05, 2015, 10:36:20 PM »
I vaguely remember running into some odd issue early in Windward's development where the content of a sub-panel (scroll view) would sometimes not be pixel perfect after tweening the scale of its parent panel (a window). What I did to fix it after trying to figure out why it happens, was to do this at the end of the animation:
  1. t.localScale = Vector3.one;
  2. StartCoroutine(MarkAsChangedCoroutine(t));
The function itself was:
  1.         System.Collections.IEnumerator MarkAsChangedCoroutine (Transform t)
  2.         {
  3.                 yield return null;
  4.                 if (t) t.BroadcastMessage("MarkAsChanged", SendMessageOptions.DontRequireReceiver);
  5.         }