NGUI 动态添加(改)

http://blog.csdn.net/li5414/article/details/7632474

前文提到的无法脚本制定atlas已经搞定了


                GameObject parent = GameObject.Find("需要添加到的父物体的名称");
		atlas = (UIAtlas)Resources.Load("Atlas图集名称",typeof(UIAtlas));
		UISprite sprite = NGUITools.AddSprite(parent,atlas,"sprite元素的名称");
		sprite.transform.localScale = new Vector3(1,1,1);
		sprite.transform.localPosition = new Vector3(0,0,0);
		sprite.MakePixelPerfect();

atlas = (UIAtlas)Resources.Load("sprite",typeof(UIAtlas));
这句用来动态指定atlas.

你可能感兴趣的:(Unity3d)