标签:des blog io ar os sp for div on
在后台对GameObject进行"创建"||"删除"动作
建立
public GameObject Pre;//在编辑器中用来绑定的Prefabs
public Transform _puzzle1;//节点,要将新建的放到这个下面的
GameObject a = (GameObject)Instantiate(Pre);//创建了
a.transform.parent = _puzzle1.transform;//设置新建的位置,在_puzzle1这个节点下
a.transform.localPosition = Vector3.zero;//坐标
a.transform.localScale = new Vector3(1, 1, 1);//Scale比例
UISprite item = a.GetComponent<UISprite>();//读取UISprite 并设置Size
item.height = 100;
item.width = 100;
//Instantiate用法,注意参数
//Pre 用来克隆的Prefabs
//transform.position 脚本绑定对象的位置 就像this.transform….
//transform.rotation 脚本绑定对象的角度 就像this.transform….
删除
Destroy(this.gameObject);
标签:des blog io ar os sp for div on
原文地址:http://www.cnblogs.com/ershiqibeijiu/p/4094221.html