Author Topic: Tween auto-play  (Read 5555 times)

MGB

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Tween auto-play
« on: November 23, 2012, 05:33:04 PM »
Hey,

Really need a 'don't auto-play' option on the tween stuff...
Is there any way to do this currently?  I read you can disable the tween script but that doesn't seem to work for me..?

cheers,
M

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tween auto-play
« Reply #1 on: November 24, 2012, 01:38:25 AM »
Simply disable the tween component. If you look closer at the examples, that's exactly what I do everywhere.

MGB

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Tween auto-play
« Reply #2 on: November 24, 2012, 05:48:32 AM »
Well I think there may be a bug:
I have a panel I want to scale up from 0 to 1 on a button press.
To not auto-start it I disable the TweenScale on start then enable on button click.
This was not working, hence this post.
After much messing about I've found it does work only if the TweenScale.From is NOT zero.

ed: Doesn't appear to be a div by zero problem either:  http://www.tasharen.com/forum/index.php?topic=835.0
« Last Edit: November 24, 2012, 06:11:41 AM by MGB »

MGB

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Tween auto-play
« Reply #3 on: November 24, 2012, 06:17:15 AM »
Finally got around this by setting TweenScale.From to a small negative number  :-\
Scaling up from zero seems like a reasonable thing for a user to want to do?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tween auto-play
« Reply #4 on: November 24, 2012, 08:27:18 AM »
Your original question had nothing to do with a scale of zero o_O

Yes, scale of 0 is bad. Use a small number instead such as 0.01. Fun fact: scale of 0 is bad universally. Try to scale a Unity GUI to/from zero, and you will see errors as well. It's just not valid, so don't do it.

MGB

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Tween auto-play
« Reply #5 on: November 24, 2012, 11:09:32 AM »
Post #2 above evolved into the zero problem.

I've added my own AutoStart flag:

In the UITweener class:

   public bool AutoRun = true;

and in Start()

   enabled = AutoRun;

Seems to work with the scaler, not tested with anything else yet.  At least prevents me from having to disable the component manually.
« Last Edit: November 24, 2012, 11:17:01 AM by MGB »

Disastercake

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 87
  • www.disastercake.com
    • View Profile
    • Disastercake
Re: Tween auto-play
« Reply #6 on: March 21, 2014, 11:26:32 PM »
I know this is an old topic, but I wanted to bump it to put in my vote that the tweens would benefit from a public boolean value in the inspector for playing automatically or not.  It would make life a little simpler.

Edit: I just realized that the Play and PlayReverse methods will actually enable the tween components if they are disabled.  I'm not use to that functionality in tween libraries, so my code was a little messy turning the components on and off at first.  This makes more sense now.  Sorry for the unnecessary bump.
« Last Edit: March 21, 2014, 11:43:31 PM by Disastercake »
Creator of Soul Saga.
http://www.disastercake.com