Hy all! How can I change the lookout of an object?
I tried to change the mesh, but only the meshfilter changed, I can see the same ingame with this code:
this.gameObject.GetComponent().mesh=m.mesh;
where m is a MeshFilter variable.
Tried this too:
GameObject i=Instantiate(Resources.Load("spy",typeof(GameObject))) as GameObject; this.gameObject.GetComponent().mesh=i.GetComponent().mesh;
this didn’t achieved anything…
Tried this:
Vector3 pos=this.gameObject.transform.position; Vector3 rot=this.gameObject.transform.eulerAngles; Vector3 sc=this.gameObject.transform.localScale; Destroy(this.gameObject); GameObject g=Instantiate(Resources.Load("spy"),pos,Quaternion.identity) as GameObject; g.transform.localScale=new Vector3(822.7944F,822.7944F,822.7925F);
It achieved the old object has destroyed, but the new one has the same size as the original, but looks like squashed. The collider has good size too.
I don’t know what should I do to change the lookout of an object… Please help me!