I am new about Unity and got some question about animation my character.
I have imported my character which has two animation (idle&run) on it.
Then I followed the manual to write scripts for switching my character’s motions.The coding is like:
function Start ()
{
animation.wrapMode = WrapMode.Loop;
}
function Update () {
if (Mathf.Abs(Input.GetAxis(“Vertical”)) > 0.1)
animation.CrossFade(“run”);
else
animation.CrossFade(“idle”);
}
After I pressing play button , my character doesn’t do anything. Is there anything i’m missing? Many thanks~
did you try to put the animation on seperate layers, maybe because your trying to move forward they are both overwriting eachother and he just stays put. maybe put
animation.CrossFade(“Run”)layer = 0;
and so on.
you might also need to assign the appropriate animations to the correct keys like
if(Input.GetButton(KeyCode.“any key you want”))
{
then put your code here for movement and animations.
}
hope this helps
Thanks for reply, I saw the example file that all characters have “character control” in Inspector panel. Is it necessary to set for my character if I only need to trigger different animations?