Author Topic: 9th panel on Ngui cant affect alpha  (Read 2139 times)

niak_ris

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
9th panel on Ngui cant affect alpha
« 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.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 9th panel on Ngui cant affect alpha
« Reply #1 on: December 31, 2013, 03:56:04 PM »
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.

niak_ris

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: 9th panel on Ngui cant affect alpha
« Reply #2 on: January 01, 2014, 12:08:20 AM »
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

niak_ris

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: 9th panel on Ngui cant affect alpha
« Reply #3 on: January 01, 2014, 12:19:10 AM »

niak_ris

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: 9th panel on Ngui cant affect alpha
« Reply #4 on: January 01, 2014, 12:38:36 AM »
Ok Thanks, rewriting all code with Serialize helped me :)