#no, this name ==== Figure.GetFigure(
1 messages · Page 1 of 1 (latest)
So the value in vector
ChessVector vector = ChessVector.GetCoordinatesFromVector(transform.position);
should ba a vector representation of the coordinates of the piece you clicked on
figure.getfigure returns the piece stored in your chessboard array, at the location of your piece. Are you sure your king doesn't have a (0,0) chessvector resulting in a negative index or something?
well you would have an error if that were the case
i'm sure
public bool isValid()
{
return this.x >= 1 && this.x <= 8 &&
this.y >= 1 && this.y <= 8;
}```
oh wow, you have really neat and simple code
i just clicked all the figures nearby king
so everything is working but the king
yes
how do you load pieces into the chessboard array?
are you sure your king is getting loaded into the array?
public static void SetFigure(Figure figure)
{
chessBoard[figure.coords.x - 1, figure.coords.y - 1] = figure;
}```
can you try running
Debug.Log($" {Figure.GetFigure(vector).figure.name}"); in your start method, so we can tell if it's the getfigure statement failing to find the king?
maybe you could say started or something to tell it apart
so the creation works, it can find itself, but clicking on it doesn't work, even though it does work for your other objects
and they all use the same script for that too
guy, all worked perfect when it was not .obj but primitive
alright I'm gonna sleep on this, because I'm not sure and it's 5:30 for me so I'm not an effective thinker rn. ill ping you tomorrow if I have an idea