Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    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