Mesh Renderer not rendering (86837)

I’m loading in meshes at runtime, which works fine, but if I try to move the mesh to another object’s renderer, it won’t show up. If I don’t destroy tempObj, it sits at 0,0,0 with the model showing. The mesh shows up in this object’s Mesh Filter Mesh slot, but it just doesn’t show up in the world. It’s the same issue if I copy it between any gameObjects, but it’s fine if I instantiate a new object for it.

	GameObject tempObj = Instantiate(Resources.Load(loadStr) as GameObject) as GameObject;
	tempObj.AddComponent<MeshFilter>();
	this.transform.GetComponent<MeshFilter>().mesh = tempObj.GetComponent<MeshFilter>().mesh;
	Destroy( tempObj );

[17935-qq截图20131115151146.jpg|17935]

I guess the tempObj you Instantiated already have meshFilter and meshRenderer on it.
You should add these two components on this:

this.gameObject.AddComponent<MeshFilter>();
this.gameObject.AddComponent<MeshRenderer>();

then copy mesh and material:

this.transform.GetComponent<MeshFilter>().mesh = tempObj.GetComponent<MeshFilter>().mesh;
this.transform.GetComponent<MeshRenderer>().material = tempObj.GetComponent<MeshRenderer>().material;