代码改变世界

动态加载NGUI控件无法指定position的问题

2015-01-07 14:55  呆萌的  阅读(186)  评论(0编辑  收藏  举报
1 void ShowStart()
2     {
3         GameObject start = Resources.Load("Prefabs/UI/Start") as GameObject;
4         //GameObject __start = GameObject.Instantiate(start) as GameObject;                                   这样复制NGUI的控件无法指定位置
5         GameObject _start = NGUITools.AddChild(GameObject.Find("UI Root") as GameObject, start);              //应该用这种方式
6         _start.transform.localPosition = new Vector3(640, 0, 0);
7     }