Author Topic: Destroying all TweenAlpha / TweenColor Components  (Read 5210 times)

lime-green.at

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 60
    • View Profile
Destroying all TweenAlpha / TweenColor Components
« on: February 07, 2013, 05:29:13 PM »
Hey,

i'm currently facing a little problem. I have Fades of all Widgets between my levels, but if i for example hover a button with UIButtonColor on it and then start the level load with my fade out, the button isn't correctly faded, i tried to destroy all instances of TweenAlpha and TweenColor, but this results in the fade isnt done at all:

For example:
  1.         foreach (UIWidget wid in widgets)
  2.         {
  3.             if (wid.gameObject.collider)
  4.                 wid.gameObject.collider.enabled = false;
  5.  
  6.             if (wid.gameObject.GetComponent<iTweenEvent>())
  7.                 Destroy(wid.gameObject.GetComponent<iTweenEvent>());
  8.  
  9.             if (wid.gameObject.GetComponent<TweenAlpha>())
  10.                 Destroy(wid.gameObject.GetComponent<TweenAlpha>());
  11.  
  12.             if (wid.gameObject.GetComponent<TweenColor>())
  13.                 Destroy(wid.gameObject.GetComponent<TweenColor>());
  14.  
  15.             TweenAlpha.Begin(wid.gameObject, duration, 0);
  16.         }
  17.  
Got any suggestions for me?
Regards

cayou

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 3
  • Posts: 90
    • View Profile
Re: Destroying all TweenAlpha / TweenColor Components
« Reply #1 on: February 08, 2013, 02:12:02 PM »
If you want to get around this issue, try to use another tween lib, that provides more control on tween objects, like HOTween for example.
Because you can easily tween alpha from all UIWidgets, it could be a great alternative.

  1. Tweener tweener = HOTween.To(myWidget, 1f, new TweenParms().Prop("alpha", 0f));
  2.  
  3. [...]
  4. HOTween.Kill(transform);
  5. //or
  6. tweener.Kill();
  7.