unity---克隆/贴图/平移/旋转
克隆
GameObject clone =Instantiate(gameObject,new Vector3(10,10,10),Quaternion.identity);
Destroy(clone,5);//5秒后自动销毁
添加图片
public Texture tex;//存储图片
Renderer ren;
ren =gameObject.GetComponent<Renderer>();
ren.material=null;
ren.material.mainTexture=tex;
平移
if(Input.GetKey(KeyCode.RightArrow))this.gameObject.transform.Translate(new Vector3(0f,0f,Time.deltaTime*10));
else if(Input.GetKey(KeyCode.LeftArrow))this.gameObject.transform.Translate(new Vector3(0f,0f,-Time.deltaTime*10));
else if(Input.GetKey(KeyCode.UpArrow))this.gameObject.transform.Translate(new Vector3(Time.deltaTime*10,0f,0f));
else if(Input.GetKey(KeyCode.DownArrow))this.gameObject.transform.Translate(new Vector3(-Time.deltaTime*10,0f,0f));
旋转
obj.transform.Rotate(0f,Time.deltaTime*50,0f);