I m trying to play 2 animation run & jump ,in inspector both have take001 animation,i m using crossfade but my program is not working,can any one help ? code
Those two lines doesn't make mush sense:
You add the default clip of the animation component 2 more times to the component with a different name. Also your two public Animation references seems to be a bit strange. What other animation components have you linked there? I guess you want to add AnimationClips. So either add the clips in the inspector directly to the Animation component, or if you want to add them via code, make the public variables of type AnimationClip and add them to the animation component.
Next thing is: wrapmode and layers should be set in Start and not in Update (unless you plan to overwrite them somewhere at some time).
Last thing is:I guess you mixed up your animations. the walk animation should be looping and the jump animation should be playing once. Also You play the animation again and again while the input axis is greater than 0.2. Are you sure that's what you want? Usually a jump is a one time action and you should use Input.GetButtonDown, but that's a conceptual thing we can't answer for you.
answered Aug 13 '12 at 04:38 PM