Author Topic: Turning on TweenScale via code works, turning off doesn't, why?  (Read 2140 times)

SuperTalesNat

  • Guest
I've got a parent object with multiple children GameObjects that have TweenScale's on them that turn on/off (or are supposed to.

The turning on works fine, but for some reason, the same code, but with inverse booleans and a reset, doesn't work.

Why?

TURNING ON: (works fine)
  1.                
  2. TweenScale[] rtc = RecButton.GetComponentsInChildren<TweenScale>();
  3. foreach (TweenScale ts in rtc) 
  4. {
  5.         ts.GetComponent<TweenScale>().Play(true);
  6. }
  7.  

TURNING OFF: (doesn't turn off the tweens???)
  1. TweenScale[] rtc = RecButton.GetComponentsInChildren<TweenScale>();
  2. foreach (TweenScale ts in rtc) 
  3. {
  4.         ts.GetComponent<TweenScale>().Play(false);
  5.         ts.GetComponent<TweenScale>().Reset();
  6. }
  7.  

SuperTalesNat

  • Guest
Re: Turning on TweenScale via code works, turning off doesn't, why?
« Reply #1 on: May 13, 2013, 03:18:46 PM »
Also, i've seen the 'AnimationOrTween' script, and could possibly use that for this, but i'm totally unsure of how that class works alongside the tweens in NGUI.

Would love an example of how to fix the original TweenScale issue, but also an example of AnimationOrTween and how that could be used (if its even viable) in this context.

Thanks!

-Nat

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Turning on TweenScale via code works, turning off doesn't, why?
« Reply #2 on: May 14, 2013, 02:18:05 AM »
That doesn't turn off tweens, it simply plays them in reverse. Although with the Reset() after Play(false) I'm not even sure what will happen. Likely nothing will happen at all.

Turn them off by simply setting .enabled = false.