Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: turkeypotpie on December 18, 2012, 04:44:15 PM

Title: Bug with UIPanelAlpha?
Post by: turkeypotpie on December 18, 2012, 04:44:15 PM
I added a UIPanelAlpha component to my panel node, and set its Alpha value to 0.

In another script, I use iTween to change the alpha value:

  1.  
  2.     public float fadeInTime = 0;
  3.  
  4.     private void Start() {
  5.         if (fadeInTime > 0) {
  6.             iTween.ValueTo(gameObject, iTween.Hash(
  7.                 "from", 0,
  8.                 "to", 1,
  9.                 "time", fadeInTime,
  10.                 "onupdate", "OnFadeInUpdate"));
  11.         }
  12.     }
  13.  
  14.     private void OnFadeInUpdate(float amount) {
  15.         GetComponent<UIPanelAlpha>().alpha = amount;
  16.     }
  17.    
  18.  

The fade itself works ok, but after the fade, the buttons are in a disabled state.


If I remove the following lines in UIPanelAlpha.cs:
  1.  
  2.                 // Fade out finished -- disable all game objects
  3.                                 Transform trans = transform;
  4.                                 for (int i = 0, imax = trans.childCount; i < imax; ++i) NGUITools.SetActive(trans.GetChild(i).gameObject, false);
  5.                                 mLevel = 0;
  6.  
  7.  

... then the problem goes away.  Why does it think there was a fade out when the alpha value started from zero?
Title: Re: Bug with UIPanelAlpha?
Post by: turkeypotpie on December 18, 2012, 05:09:54 PM
Just tried the same thing with NGUI's builtin alpha tweener, and things work ok.

Though this should still probably be fixed so things can be piped in from the outside.