Problem with playing multiple animations for a character

Hi guys,

I’m working on a small fighter game, here I’m facing problem on play multiple animations for a same character. Here is the situation for my problem, i have joysticks for make player to move and put fight with his opponent, consider now am continiously pressing right button in left joystick , it will make player to move forward, in the meanwhile am pressing right button in right joystick (it contains Punching animation for character ), but its always making move forward animation to player punching animation not affected to my character.

I need to get punching animation also when moving my character. How can i able to achieve this ?

I’m using Crossfade for animations now, any other (Blend, blend addictive) will help here ?

Any suggestions.


Here is the perfect answer for working animations.

public Transform shoulder;
public bool isEnabled;
AnimationState mixAnimation;

void Start() {
    animation["walk"].wrapMode = WrapMode.Loop;
    mixAnimation = animation["punch"];

    mixAnimation.weight = 1.0f;
    mixAnimation.wrapMode = WrapMode.ClampForever;
    mixAnimation.layer = 10;
    mixAnimation.blendMode = AnimationBlendMode.Blend;
    mixAnimation.enabled = false; 

void Update () {
    if(Input.GetButtonDown("Jump")) {
    animation["walk"].wrapMode = WrapMode.Once;
        mixAnimation.enabled = true;

AddMixingTransform might be your solution:

I actually never really tried that before so I went on a search and made it happen :).

So I used that thread so I don’t claim all the reward:

so my answer is pretty much a copy of it… (No need to upvote my answer just upvote the original one)

So you need to have a Transform variable that represents the part of the body you want to animate differently and an AnimationState variable.
Open up your character hierarchy and define what is the part of it that should react differently. Let’s say the upper part.

Then in the start or awake, you give a higher value for layer so that it takes higher priority when called upon other animation that should be playing. That is if your walking anim is 1 you might go with anything above 1 so that your shooting anim is played for sure.

Then you need to make the animation mode blended so that you do not get a weird animation based on the two.

Finally, you add the transform with AddMixingTranform.

Now the script:

public Transform topBody; //Drag here the part you want to move differently
AnimationState animMix;

void Start(){
   mixAnim = animation["shoot"];
   mixAnim.layer = 10.0f;
   mixAnim.blendMode = AnimationBlendMode.Blend;
   mixAnim.enabled = false;
void Update(){
   if(Input.GetMouseButtonDown(0))mixAnim.enabled =true;

Now this is just the basics as you still need to get your shooting animation off but once you got that far it should be fairly easy to tweak it off.