Textures break when mesh stops sharing vertices

I have a program which stops a mesh sharing vertices in the editor. However when I run a process on a test (see below) the textures go all weird and all go onto certain part of the robot not the whole thing.

Here is my code:

void Process() {

        Transform curr = Selection.activeTransform;
		
		if (curr == null) {
			error = "Please select an appropriate object in the heirarchy";
			Debug.Log (error);    
			return;
		}
		
		MeshFilter meshFil;
		meshFil = curr.GetComponent<MeshFilter>();
		if (meshFil == null || meshFil.sharedMesh == null) {
			error = "No editable mesh filter is detected on selected object 

(" + curr.name + “)”;
Debug.Log (error);
return;
}

		GameObject gamObj = Instantiate (curr.gameObject) as GameObject;
		meshFil = gamObj.GetComponent<MeshFilter>();
		Mesh mesh = Instantiate (meshFil.sharedMesh) as Mesh;
		meshFil.sharedMesh = mesh;
		Selection.activeObject = gamObj.transform;

		Vector3[] oldVerts = mesh.vertices;
		int[] trigs = mesh.triangles;
		Vector3[] newVerts = new Vector3[trigs.Length];
		for (int i = 0; i < trigs.Length; i++) {
			newVerts _= oldVerts[trigs*];*_

_ trigs = i;
* }
mesh.vertices = newVerts;
mesh.triangles = trigs;*_

* mesh.RecalculateBounds();*
* mesh.RecalculateNormals();*
}

You’re losing all the texture coordinates of the mesh, because you’re not recalculating mesh.uv.