Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: niak_ris on December 31, 2013, 03:50:06 PM
-
Hello! I have some simple code in Start():
pt=(UIPanel)GameObject.Find("PanelText").GetComponent(typeof(UIPanel));
pt2=(UIPanel)GameObject.Find("PanelText2").GetComponent(typeof(UIPanel));
pt3=(UIPanel)GameObject.Find("PanelText3").GetComponent(typeof(UIPanel));
pt4=(UIPanel)GameObject.Find("Panelzz").GetComponent(typeof(UIPanel));
pt5=(UIPanel)GameObject.Find("PanelText5").GetComponent(typeof(UIPanel));
pt.alpha=0;
pt2.alpha=0;
pt3.alpha=0;
pt4.alpha=0;
pt5.alpha=0;
It worked great before i added more than 9 panels. right now on Start pt4.alpha=0 dont't work. I can make that alpha==0 only in Update() function. 3.0.2 version.
-
Widget and panel alpha is cumulative. If you set something to 0, all its children will be automatically invisible.
Why do you have so many panels, and why do you keep doing GameObject.Find by name? Make public variables, set them in inspector. GameObject.Find should be removed from Unity.
-
It's my tutorial scene with interactive actions. i am using many panels for exchange labels in different conditions(many Labels for different languages with NGUI localization script). i dont understand why but all alpha=0 works fine, only pt4.alpha=0 dont work, In Update in first frame it became 1
-
(http://i.imgur.com/i1hBUeP.png) (http://imgur.com/i1hBUeP)
-
Ok Thanks, rewriting all code with Serialize helped me :)