text: What i did so far:
  Created new animator controller for my third person character.
  Created a From New Blend Tree called it Movement and i did a Transition from the Entry to the Movement.
  Created a new State called it Aiming and assigned in as motion Rifle_Aiming_Idle
  Created two transitions from Movement to Aiming and from Aiming to Movement. From movement to aiming the conditions: Aiming True and from aiming to movement the conditions are: Aiming False.
  Inside the Movement blend tree i added two new motions: HumanoidIdle and Rifle_Aiming_Walk_F_RM
  Added parametersL Velx,Vely both float and also parameter name Aiming bool.
  HumanoidIdle set to 0 and 0 and Rifle_Aiming_Walk_F_RM is set to 0 and 1.
  Then i attached to the character this script:
  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  public class Soldier : MonoBehaviour
  {
  private Animator anim;
  private bool aim = false; (aim == true)
  {
  anim.SetBool("Aiming", true);
  anim.SetFloat("VelX", inputVelx);
  anim.SetFloat("VelY", inputVely);
  }
  if (Input.GetMouseButtonDown(1))
  {
  anim.SetBool("Aiming", !anim.GetBool("Aiming"));
  }
  }
  private void FootStep()
  {
  }
  }
  And the results:
  When running the game the character start in idle state. When i press the W key the character is walking forward and also aiming at the same time. When i leave the W key the character is back to idle state without aiming.
  If i click the mouse right button the character will aiming but will stay in aiming idle state if i press now W he will not move.
  My main goal is how to make that when i click the mouse right button it will aiming and also when pressing W will walk. Now it's only aiming but when i press W it's not walking.
  Screenshots:
  The first is the parameters with the main layer: On the right you can see the state Aiming with that i'm doing the right mouse button click to get to aiming state and this is where i also want to make that if i press W it will also walk.
  The second screenshot show the blend tree mixing the idle with the walking this part is working fine:
  In other words i want to make that right mouse click i'm in aiming idle state and if i will press then the W key it will start walking if i leave the W key he will back to aiming idle state.
  Answer by cgarossi
  ·
  Sep 04, 2017 at 11:46 AM
  Try this:
  void Update()
  {
  var inputVelx = Input.GetAxis("Horizontal");
  var inputVely = Input.GetAxis("Vertical");
  transform.Rotate(0, inputVelx, 0);
  anim.SetFloat("VelX", inputVelx);
  anim.SetFloat("VelY", inputVely);
  aim = Input.GetMouseButtonDown(1);
  anim.SetBool("Aiming", aim);
  anim.SetFloat("VelX", inputVelx);
  anim.SetFloat("VelY", inputVely);
  }
  You can set the aim but reading the mouse buttom, you don't need to set it anywhere else. Also you only have to set the VelX and VelY parameters once according to the Horizontal and Vetical axis values.
  Edit: You may also want to consider an avatar mask. If you only have a stationary aim animation then you can mask the legs and bottom half of the avatar so that you can play both the walking and aiming states together.
  About the avatar mask i need to learn it yet. About your solution code it's not working yet good. The part that when i press W and it's start walking and aiming is fine but when i click the right mouse button now it's aiming and right away back to idle without aiming. It's not staying aiming like before so i can't even test if it's walking.
  That's why you need an avatar mask. Your aim animation is idle and does not move, but your walking animation does not aim but moves. The two conflict. One animation is saying 'move forward' the other is saying 'stay still'.
  You can solve this with animation layers and an avatar mask. I suggest you research.
  How do i use the animator avatar mask to combine two animations ?
  0
  Answers
  why I have to anim.getComponent in update() function when I had done in Start () function
  2
  Answers
  Animation plays one frame then freezes on that first frame.
  0
  Answers
  Help with animator controllers
  1
  Answer
  Why when creating new animator controller for the character the character is not walking right ?
  0
  Answers