6 Replies
1: don't write get and set methods, C# has properties for this purpose
2: your ResetBoard code has a path that passes
null
as a piece
as for "every time," that's not true so you'll have to be more specific about what code isn't working and what exceptions you're getting
as an example of properties, your Spot
class should be
hi thanks i wasnt i aware im new to c#
"2: your ResetBoard code has a path that passes null as a piece" what do u mean by this?
i mean you have a line:
boxes[i, j] = new Spot(i, j, null);
that is the only place i see null being set as the pieceeven without that if i just have
boxes[0, 0] = new Spot(0, 0, new Horse());
Debug.Log(boxes[0, 0].Piece); it still returns null when i try to access the piece nvm im just been stupid it does work thanks for ur help
Debug.Log(boxes[0, 0].Piece); it still returns null when i try to access the piece nvm im just been stupid it does work thanks for ur help