Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: chiuan on January 05, 2014, 10:39:07 PM

Title: UIScrollView.uipanel not draw children, but draw by UIPanel in parent
Post by: chiuan on January 05, 2014, 10:39:07 PM
 :'(

  1.         void refreshServerList()
  2.         {
  3.                 for(int i =0 ; i < PomeloManager.Self.gameServerList.Count; i++)
  4.                 {
  5.                         createServerItem(PomeloManager.Self.gameServerList[i]);
  6.                 }
  7.                 //tableServer.repositionNow = true;
  8.                 tableServer.Reposition();
  9.                 scrollViewServer.ResetPosition();
  10.         }
  11.  
  12.         void createServerItem(PomeloManager.GameGate gate)
  13.         {
  14.                 //GameObject go = Instantiate(templateServerItem.gameObject) as GameObject;
  15.                 //go.transform.parent = tableServer.transform;
  16.                 //go.transform.localScale = Vector3.one;
  17.  
  18.                 GameObject go = NGUITools.AddChild(tableServer.gameObject, templateServerItem.gameObject);
  19.                 go.SetActive(true);
  20.                
  21.                 UIGameServerItem item = go.GetComponent<UIGameServerItem>();
  22.                 item.gate = gate;
  23.                 serverItems.Add(item);
  24.         }
  25.  

scroll(Contain UIPanel & UIScrollView Components) nothing show On Drawcall popup window. but, i found the children all draw by 3_ServerList(UIPanel).
Title: Re: UIScrollView.uipanel not draw children, but draw by UIPanel in parent
Post by: ArenMook on January 06, 2014, 10:23:36 AM
Use NGUITools.SetActive instead of go.SetActive. GameObject.SetActive activates children before parents, which is a long-standing bug in Unity.