Animator.SetBool doesn't work first time

I have a script from which I change a boolean parameter in an animator:

if(toggle && Input.GetButtonDown("Fire2") && wType == weaponType.sniper)
                animator.SetBool("sniperScoped", !isAimed);

I then (in the same if statement) check if “isAimed” is true or false and call a function accordingly.

The problem I’m having is that the boolean parameter doesn’t change the first time I right click. However, if I press it again, it works fine…

Does anyone know what causes this problem and or how to fix it?

My guess would be that the problem stems from the bool isAimed. Without actually seeing where that value is being set, I have not way of giving a definitive answer.

A quick test would be to just hardcode the value to true or false. If it’s still not being set the first time then it’s definitely a larger issue.