AimScript tps Issues

if (Input.GetMouseButton(1))
{
anim.SetBool(“aiming”, true);
inputHandler.aiming = true;
}
else if (Input.GetMouseButton(0) && !inputHandler.aiming)
{
anim.SetBool(“aiming”, true);
mtranform.transform.forward = Camtran.transform.forward;
}
else
{
anim.SetBool(“aiming”, false);
inputHandler.aiming = false;
}

When I hold the left mouse button down it keeps using the if and else statements parts of the function. So it we’ll aim than set it to false and vice versa over and over again.

My character just keeps stuttering between aim false and aim true. I’m not sure why. If the present code is good than it must be something else…

Maybe Input.GetMouseButtonDown and Input.GetmouseButtonUp - may help you?
When you use Input.GetMouseButton - that method is calling by Unity every frame when button is holding.