Author Topic: Paused game  (Read 7624 times)

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Paused game
« on: July 01, 2012, 08:04:45 AM »
Hi,

does UIButtonPlayAnimation play an animation regardless of Time.timeScale value? I found this

1.50
NEW: The UI is now timeScale-independent, letting you pause the game via Time.timeScale = 0.

yet when I pause the game (Time.timeScale = 0) the animation doesn't play (otherwise it does). Should this work? Am I doing something wrong?

Thanks a lot

A.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Paused game
« Reply #1 on: July 01, 2012, 10:19:02 AM »
I think there's a public bool you set in the inspector for the animation.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Paused game
« Reply #2 on: July 01, 2012, 11:32:08 AM »
UIButtonPlayAnimation activates an animation via ActiveAnimation class, which samples it framerate-independent. Animation.Play() is not.

Alessaint

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 67
    • View Profile
Re: Paused game
« Reply #3 on: July 02, 2012, 02:52:37 AM »
Thanks for the reply - unfortunately I'm not sure I fully understand though :)

Do you mean that UIButtonPlayAnimation doesn't rely on Animation.Play() and so it can play an animation even when the game is paused? Because I'm using UIDButtonPlayAnimation and yet I can't get it to work for some reason...

In another words -if I add UIButtonPlayAnimation to a button, fill in animation name and after pressing the button pause the game, the animation should still play?

Thanks

@Nicki: thanks for a hint - unfortunately I couldn't find anything like that in the animation's inspector settings

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Paused game
« Reply #4 on: July 02, 2012, 12:40:10 PM »
That's correct, UIButtonPlayAnimation does not rely on Animation.Play(). Did you set the target animation? It won't work without it.

jeldrez

  • Sr. Member
  • ****
  • Thank You
  • -Given: 8
  • -Receive: 4
  • Posts: 352
    • View Profile
Re: Paused game
« Reply #5 on: February 17, 2014, 10:41:25 AM »
Sorry for the bump, but there's anyway to play anims with timescale=0?
I couldn't find any option for that in the last version.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Paused game
« Reply #6 on: February 17, 2014, 10:46:53 AM »
ActiveAnimation.Play is always timescale-independent, which is what UIPlayAnimation uses.