I get the animator with the parameters and everything, and i can turn things true or false, but i’m not sure how to use them in my script (javascript). I have let’s say a boolean called Attack that turns to true when you click ‘Fire1’. I can use it and it works when i manually turn it on in the animator, but how do i make it so that when you left click it makes Attack true, which then plays the attack animation. Thanks
In your script, you would use Animator.SetBool to set that boolean, just as if it had been turned on in the animator editor.
So, something like-
Animator animator = GetComponent<Animator>();
if (Input.GetButton ("Fire1")){
animator.SetBool("nameofbool", true);
}
else animator.SetBool("nameofbool", false);
I did that with the right booleans, this was the code
Animator animator = GetComponent<Animator>();
if (Input.GetButtonDown("Fire1"))
{
//Attack
animator.SetBool("Attack", true);
but i get these errors: ‘;’ expected. insert semicolon at the end
'unexpected token: )
expecting ), found ‘;’
they’re all for the same line, the Animator animator = GetComponent();
why does this happen?