So i’m making a chess like game (2d), and to select a peice to move, you need to click it. I thought of using a OnMouseDown function, but only the first object i put on the scene responds to it, and it responds wherever i click.
Any help is apreciated!!,So im making this chess like game, and im making it so when you click a piece, it moves. My issue, is that wherever i click, it chooses the first one i put in the scene. Here is the code:
public class Movement : MonoBehaviour
{
void OnMouseDown()
{
manager.GetComponent().selected = self;
}
void Update()
{
// movement code
}
}