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:
public float fadeInTime = 0;
private void Start() {
if (fadeInTime > 0) {
iTween.ValueTo(gameObject, iTween.Hash(
"from", 0,
"to", 1,
"time", fadeInTime,
"onupdate", "OnFadeInUpdate"));
}
}
private void OnFadeInUpdate(float amount) {
GetComponent<UIPanelAlpha>().alpha = amount;
}
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:
// Fade out finished -- disable all game objects
Transform trans = transform;
for (int i = 0, imax = trans.childCount; i < imax; ++i) NGUITools.SetActive(trans.GetChild(i).gameObject, false);
mLevel = 0;
... then the problem goes away. Why does it think there was a fade out when the alpha value started from zero?