Author Topic: Pause and Tween Animations  (Read 3394 times)

capitalj

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 88
    • View Profile
Pause and Tween Animations
« on: January 23, 2013, 07:29:56 PM »
Hi, I've setup a pause menu where the pause button changes the timescale to very slow, ie: Time.timescale = 0.0001f

And then I call a Tween Position animation that moves a pause menu onto the screen. I've found that in the editor this causes all of the buttons on the pause menu to stop working, but on an iOS device the same code works 95% of the time (5% of the time the same thing happens and the pause menu buttons don't work). The janky fix I've found for this is to add a 0.5 second delay before the timescale gets changed.

Any ideas on how to fix this so that the pause menu buttons don't freeze? (these are all located on the same panel as most of the other game UI and the panel is not static)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Pause and Tween Animations
« Reply #1 on: January 23, 2013, 07:31:46 PM »
IgnoreTimeScale flag on your tweens must be checked, or they will obey timeScale rules.

Also -- why are you setting it to 0.0001f instead of just 0?

capitalj

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 88
    • View Profile
Re: Pause and Tween Animations
« Reply #2 on: January 23, 2013, 07:40:53 PM »
Yes, Ignore time scale is selected (hence the menu animates in just fine, even without the time delay).

I'm using 0.0001 because some other AI code gives me strange errors when the timescale is 0, so I'd rather not fool around with that stuff and the 0.0001 is just as effective at pausing.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Pause and Tween Animations
« Reply #3 on: January 24, 2013, 09:32:53 AM »
It's not though. The game is still running, just very slowly. 0.0001 * 0.001 = very small number. You may be running into precision issues here.

luisdiv

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Pause and Tween Animations
« Reply #4 on: February 18, 2013, 12:56:07 PM »
Hello! I have exactly the same issue in my game :-\. I'm trying to use a 0.001f TimeScale...

Did you ever solve this problem? How did you?  ???

Luis

mmuller

  • Guest
Re: Pause and Tween Animations
« Reply #5 on: February 18, 2013, 03:52:39 PM »
luisdev/capitalj,

It might be better to have a singleton/global that sets a boolean for when the game is running or not, set this when pausing and then wrap any items/scripts that need to be 'paused' in a test of the boolean. Setting TimeScale to 0.0001f is going to cause pain...

Regards,

Mark

luisdiv

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: Pause and Tween Animations
« Reply #6 on: February 19, 2013, 01:41:59 PM »
Thanks,

I ended up changing mi code so that I could use a 0 TimeScale ;D