Add values to Int[] (SetTriangles)

Hi,
First, I’m sorry for my english, I’m french, I’ll do my best to express myself.

I have to change some triangles of a submesh into another one, when the player hit it.
That’s how I did it :

		//TriInfo[2] is the index of the triangle in the submesh 0 I want to assign to the submesh 1
		//GoMesh is the mesh I'm working on

		//Define an Array wich will contain the triangles of the submesh 1 and the new one
		int[] AddTriangle = new int[GoMesh.GetTriangles (1).Length + 3];
		for (int i=0; i<GoMesh.GetTriangles (1).Length; i++){
			AddTriangle_=GoMesh.GetTriangles(1)*;*_

* }*

_ AddTriangle[GoMesh.GetTriangles(1).Length]=GoMesh.GetTriangles(0)[TriInfo [2]*3];
AddTriangle[GoMesh.GetTriangles(1).Length+1]=GoMesh.GetTriangles(0)[TriInfo [2]*3 + 1];
AddTriangle[GoMesh.GetTriangles(1).Length+2]=GoMesh.GetTriangles(0)[TriInfo [2]*3 + 2];_

* //I assign the new array AddTriangle to the submesh 1*
* GoMesh.SetTriangles (AddTriangle, 1);*
It works, but it is a frequent request and, when the int[] gets long, the game lags.
It has to be a int[] and not a list (for the function SetTriangle), and i didn’t find a better way to add values to it.
Thank you for reading, and if you have a solution, i would be really grateful.

I would look at Buffer.BlockCopy
I’m not sure about these sub meshes you indexing but something like this will be faster

		const INT_LENGTH_IN_BYTES = 4;
		int[] subMesh0Tris = GoMesh.GetTriangles(0);
		int[] subMesh1Tris = GoMesh.GetTriangles(1);

		int[] newTriangles = new int[subMesh1Tris.Length + 3];
		Buffer.BlockCopy(subMesh1Tris, 0, newTriangles, 0, subMesh1Tris.Length * INT_LENGTH_IN_BYTES);

		newTriangles[newTriangles.Length-3]=subMesh0Tris[TriInfo[2]*3];
		newTriangles[newTriangles.Length-2]=subMesh0Tris[TriInfo[2]*3 + 1];
		newTriangles[newTriangles.Length-1]=subMesh0Tris[TriInfo[2]*3 + 2];

		//I assign the new array AddTriangle to the submesh 1
		GoMesh.SetTriangles (newTriangles, 1);

I did not test this but it should be close to what you’re looking for