private static int ExtractMatrix(ref Matrix4x4 mat, float[] data, int i = 0) { // Matrices returned from our native layer are in row-major order. for (int r = 0; r < 4; r++) { for (int c = 0; c < 4; c++, i++) { mat[r, c] = data[i]; } } return i; }