Add Mixing Transform Doesn't Work!!


I’ve made this work on a character currently in my scene, but I just can’t get it to work on the newest character I have added.

Here is the scripting I have been using

function Start ()
animation[“machineGunShoot”].layer = 14;
animation[“laserShoot”].layer = 14;

var mixShootLaserGun : Transform = transform.Find("waistM/back1M/back2M/RclavicleM/RshoulderM/RelbowM/RwristM/Rcannon1M");


var mixMachineGun : Transform = transform.Find("waist/back1/back2/Lclavicle/Lshoulder");



function Update ()
if (Input.GetAxis(“R_Trigger”) > 0.1 && animation.IsPlaying(“idle”))



Can anyone see any problems with what I have done? Or help me understand why it isn’t working?


The code you’re using before the Update function never gets used because you’re just playing your standard lasershoot animation. add Debug.Log(“Laser Shooting”); before the“laserShoot”); to see if the if statement is executed.

I just tried that, and the animation is playing. It just isn’t isolating the bones I want to play the animation on :confused:

It should work, because I used the same code for a character in the same game (obviously defining different bones) I just don’t understand why it will work for one character and not for another!

I think you missed some ( and ).

Try with that :

function Update () { if ((Input.GetAxis("R_Trigger") > 0.1) && (animation.IsPlaying("idle")))


Not sure if this is related, but whenever I set AnimationState.layer to anything other than the default (0), I get a null reference exception.

Try removing the part where you change the ‘animation[“animName”].layer’ at the start and see if the exception goes away.