Good to curse Ah, finally solved
Problem
I use Blendtree to let the character run, turn left, turn right, jump the function, but the character other animations play normal, as long as the steering is not moving in situ
Cause: The animation will not move when it is finished, set the Loop property on the line.
Using Blendtree
1 animations If you are only moving in situ, you can add motion curves to the animation (curves, in the animation window) and then add motion codes to the characters
In the Onanimatormove function
void Onanimatormove () { Animator Animator = getcomponent<animator> (); if (animator) { Vector3 newposition = transform.position; Newposition.z + = animator. GetFloat ("Run") * TIME.DELTATIME; Transform.position = newposition; } }
2 Create controller controllers, add animations to controllers, add Blendtree, add variables to controller if you want to control animated motion by condition condition control character movement
Add code
public class Blendtree1:monobehaviour { Animator animator1; public float speed1 = 0.08f;//with this for initializationvoid Start () { Animator1 = getcomponent<animator> ();} Update is called once per framevoid update () { if (Animator1) { Animatorstateinfo statinfo = Animator1. Getcurrentanimatorstateinfo (0); if (Statinfo.isname ("Base layer.run")) { if (Input.getkey (KEYCODE.A)) { Animator1. Setbool ("Jump", True); } } else { Animator1. Setbool ("Jump", false); } float horizontal = Input.getaxis ("horizontal"); Animator1. SetFloat ("Speed", horizontal, speed1, time.deltatime);}}
Unity Animator BlendTree1