Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: MGB on November 23, 2012, 05:33:04 PM

Title: Tween auto-play
Post by: MGB 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
Title: Re: Tween auto-play
Post by: ArenMook 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.
Title: Re: Tween auto-play
Post by: MGB 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
Title: Re: Tween auto-play
Post by: MGB 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?
Title: Re: Tween auto-play
Post by: ArenMook 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.
Title: Re: Tween auto-play
Post by: MGB 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.
Title: Re: Tween auto-play
Post by: Disastercake 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.