Quick question guys in relation to triggering an animation after death. I am using the 3rd person controller that comes with unity for character control.Everything is set up and working fine but there is no death animation if the player is destroyed. I have one ready to go I just need to know how to call it from the script. I found the animation.play tutorial on untiy’s scripting reference site but don’t really get how to implement it. Any help much appreciated!
1 Answer
1animation.CrossFade(“name of animation”);
Hey cowasockytommy! Cheers for the reply! Just wondering where I would put this line? Does it do into my 3rd person controller script? And if so do you know where? Completely new to this, learning as I go!
– bundy2k6well it depends. basicly you only have that script right?
– cowasockytommybut yes most likey in your 3rd person controller script is where it would go
– cowasockytommyYa I'm using the built in unity 3rd person controller and then I added a separate Player dies script and attached it to the player as well. function OnTriggerEnter () { Destroy (gameObject); }
– bundy2k6ok you would put the animation line b4 the destroy line and you might need to make yield waitforseconds or something so your animation will finish playing b4 destroyed
– cowasockytommy