When I put the third person controller script on my character, it moves but has no animations, even though I recorded animations for it.
How do I fix this?
When I put the third person controller script on my character, it moves but has no animations, even though I recorded animations for it.
How do I fix this?
You have to call animations with a script. For example:
if (player.isMoving() && !animation.IsPlaying("run")) {
animation.Play("run");
} else if (player.isStanding() && !animation.IsPlaying("idle")) {
animation.Play("idle");
}
You could also use the velocity variable of your character controller if this fits your requirements:
if (characterController.velocity != Vector3.zero && !animation.IsPlaying("run")) {
animation.Play("run");
} else if (!animation.IsPlaying("idle")) {
animation.Play("idle");
}
And another way would be using unity’s mecanim animation system.
Animation Scripting Reference: http://docs.unity3d.com/ScriptReference/Animation.html
Unity Mecanim Tutorial: https://www.youtube.com/watch?v=Xx21y9eJq1U