No overload for method 'SetTrigger' takes 2 arguments ISSUE

What does that mean when that error pops up specifically? im trying to set my trigger like this

anim.SetTrigger(“attacking”, true);

and its for this code build here im trying to put together so that i cant move while attacking

so the script attempt looks like this currently (but the compile error happens over the Set trigger set up that way)

void Update()
    {
        if (Input.GetButtonDown("Attack"))
        {
            Attack();
        }
        if (canMove)//
        {
            //movement
            anim.SetBool("isRunning", true);
        }
    }

void Attack()
    {
        anim.SetTrigger("attacking", true);
        if (!isAttacking)
        {
            anim.SetBool("isRunning", false);//
            canMove = false;//
        }
        else//
        {
            canMove = true;//
        }



    }

what is a better way to set that up so that the Compile error doesnt happen? Im currently still tinkering while i wait

Thanks

The Animator.SetTrigger method only takes one argument. You just give it either the name or ID of the trigger only:

anim.SetTrigger("attacking");

Ah ok so i can only use A Set_Bool_ expression (for the Animator) right?

im not back home yet to check and try but are you saying i have to change it to anim.SetBool(“attacking”, true);
In order for it to work properly that way? Because thats what i was trying to get working

If the “attacking” variable in your Animator is defined as a trigger, you use SetTrigger.
If it’s defined as a bool, then you use SetBool.

A bool has a value can be set to true or false, hence why you specify the value in SetBool:

animator.SetBool("MyBoolean", true);

A trigger has no value - its purpose is just to notify the Animator that something happened & it should update its state, hence why you don’t specify any value in SetTrigger:

animator.SetTrigger("MyTrigger");

Ok think i asked the question wrong then.

Would it be better to use the Bool instead of Trigger since i want to use the “,true” with it like this:

anim.SetBool(“attacking”, true); ?

Because im thinking i need to change what i had before using “Trigger” to bool now because i want to build it properly with that initial method i was going for to try to stop all movement when is attacking. But anyway im at noob level at this stuff. been reading documents but its only showing me definitions and not many in depth examples how Settrigger or setbool would look in those type of build expressions

thanks again for the reply. Ill be home in a bit to dig in again

Up to you. If you think it makes more sense for “attacking” to be a bool instead of a trigger, then feel free to make it so.