学一下Scroll View。

NGUI的封装还是不错的,自动排列,可定义一行的个数,然后自动换行。

首先得动态能添加控件,然后加到UITable容器里。

for (int i = 0; i < 10; i++)
        {
            GameObject go = NGUITools.AddChild(gameObject, template);
            
            UIDragCamera uc = go.GetComponent<UIDragCamera>();
            uc.draggableCamera = seeCam;
            go.transform.localScale = template.transform.localScale;
            
            
            item = go.transform.FindChild("UISprite").gameObject.GetComponent<UISprite>();
            item.spriteName = "Orc Armor - Bracers";
            
            
            UITable ut = gameObject.GetComponent<UITable>();
            ut.Reposition();
        }

 

效果: