How to Combine MxN different image in to one Texture2D

Lets say I have MxN different images and I want to combine them as single Texture2D.(As seen in the image) Is there a built-in(C#) function in unity for that?


While I was reading Texture2D Documentation, I saw that it can be possibly handled using getPixels() and setPixels() functions. However since getPixels() returns a flattened pixel array, it makes this solution a bit long.

Here is the solution :

private Texture2D ConcatTexture(Texture2D[,] textures, int ColumnCount, int RowCount, int tileSize)
    Texture2D finalTexture = new Texture2D(ColumnCount * tileSize, RowCount * tileSize);

    for (int i = 0; i < RowCount; i++)
        for(int j=0 ; j < ColumnCount ; j++)
            finalTexture.SetPixels(j * tileSize, (RowCount-i-1) * tileSize, tileSize, tileSize, textures[i, j].GetPixels());

    return finalTexture;