Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

From idle to Attack and move left/right (Mecanim)

Discussion in 'Animation' started by Bukyja, Sep 18, 2013.

  1. Bukyja

    Bukyja

    Joined:
    Jul 7, 2013
    Posts:
    31
    Hello everyone, i'm trying to add attack and move left/right while in idlestate, i wrote this to pass from idle to attack animation with no luck. I'm not a programmer and i'm learning opening scripts and studying the logic inside so any help is a big help for me.

    Thats the code:

    if (currentBaseState.nameHash == idleState)
    {
    if (Input.GetKeyDown(KeyCode.Mouse0))
    {
    anim.SetBool("AttackIdle", true);
    }

    else

    {
    anim.SetBool("AttackIdle", false);
    }
    }

    and this is a animator's screenshot:

    $SS_Help.jpg
     
unityunity