I have this isometric project Im working on and Im using OnMouseDown to detect the clicks on the players, but after a few clicks it seems the OnMouseDown function stops working and doesn’t detect the clicks anymore, any ideas why? posted the video on youtube hope you can see the link below
I’ve read about the null reference and what I found is a bug if you start the game with some game object selected it gives that, if you unselect the game object the game starts without the null error, but it seems unrelated to the onClick problem, about the on click I dont see how it could be the code, here is the onMouseDown function I have in the attached script, the Debug.log is the 1st line in it so it should trigger no matter what
private void OnMouseDown()
{
Debug.Log("Player was clicked");
if (isTurn)
{
wasPlayerClicked = true;
if(hasMoved == false)
{
highLighTiles(Color.blue, movementSpeed);
}
}
}
@Ulfnir I’m not pretty sure will it work but try using if(Input.GetMouseDown(0 or 1)) instead of OnMouseDown() and put it in Update() function