I have 5 different sliders on top of each other. Only one is active at a time. when I reach a certain value on the slider, I swap to a different slider and now the new slider is the one active and I deactivate the other one. However, when the swap occurs, most of the time there is a flicker as it swaps. As if there is a frame where there is no slider and then the other one appears. Initially I had it so I disabled the current slider fisrt and then enabled the new one, which I thought it was the problem. But when enabling the new one first and then disabling the old one didn't fix it either. I also tried making the Depth of the new one higher than the current, enabling it, then disabling the older and that didn't work either. Any tips? Here is the code as it stands:
void SwapFace(int targetFace){
switch(targetFace){
case 1:
NGUITools.SetActive(face1.gameObject, true);
_activeSlider = face1;
break;
case 2:
NGUITools.SetActive(face2.gameObject, true);
_activeSlider = face2;
break;
case 3:
NGUITools.SetActive(face3.gameObject, true);
_activeSlider = face3;
break;
case 4:
NGUITools.SetActive(face4.gameObject, true);
_activeSlider = face4;
break;
case 5:
NGUITools.SetActive(face5.gameObject, true);
_activeSlider = null;
break;
case 6:
NGUITools.SetActive(face6.gameObject, true);
_activeSlider = null;
break;
default:
Debug.Log("[RagemeterManager]: Invalid target rage level!");
break;
};
DisableFacesExcept(targetFace);
}
void DisableFacesExcept(int i){
if(i != 1) NGUITools.SetActive(face1.gameObject, false);
if(i != 2) NGUITools.SetActive(face2.gameObject, false);
if(i != 3) NGUITools.SetActive(face3.gameObject, false);
if(i != 4) NGUITools.SetActive(face4.gameObject, false);
if(i != 5) NGUITools.SetActive(face5.gameObject, false);
if(i != 6) NGUITools.SetActive(face6.gameObject, false);
}