public bool[,] ConvertToMatrix(RawTexture2D texture) { bool[,] matrix = new bool[5, 5]; for (int j = 0; j < 5; j++) { for(int i = 0; i < 5; i++){ bool isFound = false; for(int y = j*texture.height/5; y < (j+1)*texture.height/5; y++){ for(int x = i*texture.width/5; x < (i+1)*texture.width/5; x++){ if(texture.GetPixel(x,y).r < 255){ isFound = true; break; } } if(isFound) break; } matrix[j,i] = isFound; } } return matrix; }