Problem Description
Through Unity Input.GetMouseButtonDown, the mouse is detected and two press events occur with one click.
if (Input.GetMouseButtonDown(0))
{
Debug.LogError("GetMouseButtonDown");
}
Solution
Control a click through the up variable
bool isUp = true;
bool isDown = false;
bool IsButtonClick()
{
if (Input.GetMouseButtonUp(0) && isDown)
{
Debug.LogError("isUp");
isUp = true;
}
if (Input.GetMouseButtonDown(0) && isUp)
{
Debug.LogError("isDown");
isUp = false;
isDown = true;
}
return false;
}