- Home /
 
 
               Question by 
               ThatBulgarian · Jun 13, 2014 at 11:39 PM · 
                inputanimatorlagmechanim  
              
 
              Unity Animator Input Lag
Ok so I'm going a bit crazy. I have a script which changes which state the animator should go to depending on which key is pressed:
 void Update()
     {
         moveDirection = new Vector3(Input.GetAxis("Horizontal")//,Input.GetAxis("Jump") 
                                     ,Input.GetAxis("Mouse ScrollWheel")
                                     ,Input.GetAxis("Vertical")).normalized;
         moveDirection = transform.TransformDirection(moveDirection);
         moveDirection *= camspeed;
         Animate();
     }
 
     void FixedUpdate() 
     {
         cc.Move(moveDirection* Time.deltaTime);//*camspeed);
     }
 
     void Animate()
     {
             if(Input.GetAxis("Vertical")==1)
                 anim.SetFloat("ForwardSpeed",0.2f);
             else if(Input.GetAxis("Vertical")==-1)
                 anim.SetFloat("ForwardSpeed",-1.1f);
             else
                 anim.SetFloat("ForwardSpeed",0f);
 
             if(Input.GetAxis("Horizontal")==1)
                 anim.SetFloat("HorizSpeed",1.1f);
             else if(Input.GetAxis("Horizontal")==-1)
                 anim.SetFloat("HorizSpeed",-1.1f);
             else
                     anim.SetFloat("HorizSpeed",0f);
     }
 
               My problem is from the time I press for example the forward button, there is a delay until the vaiable in the animator is changed. Can anyone please help me?
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Whever I try to change an Animator value in my script, it becomes incredibly laggy [C#] 1 Answer
Stuttering and trigger issues after switching player sprite. 1 Answer
How to nest Animation file in an Animation Controller? 1 Answer
Get weird issue when change from Mechanim -> Ragdoll 0 Answers
How to make a character move for some time and stand for some time? 1 Answer