The playerBlack
array items have not been initialised. Change playerWhite
to playerBlack
here: playerWhite = new GameObject[] {
Create("black_rook", 7, 7), Create("black_knight", 6, 7), Create("black_bishop", 5, 7), Create("black_queen", 4, 7), Create("black_king", 3, 7), Create("black_bishop", 2, 7), Create("black_knight", 1, 7), Create("black_rook", 0, 7),
Create("black_pawn", 0, 6), Create("black_pawn", 1, 6), Create("black_pawn", 2, 6), Create("black_pawn", 3, 6), Create("black_pawn", 4, 6), Create("black_pawn", 5, 6), Create("black_pawn", 6, 6), Create("black_pawn", 7, 6),
};
playerWhite = new GameObject[] {
Create("black_rook", 7, 7), Create("black_knight", 6, 7), Create("black_bishop", 5, 7), Create("black_queen", 4, 7), Create("black_king", 3, 7), Create("black_bishop", 2, 7), Create("black_knight", 1, 7), Create("black_rook", 0, 7),
Create("black_pawn", 0, 6), Create("black_pawn", 1, 6), Create("black_pawn", 2, 6), Create("black_pawn", 3, 6), Create("black_pawn", 4, 6), Create("black_pawn", 5, 6), Create("black_pawn", 6, 6), Create("black_pawn", 7, 6),
};