I've been fiddling with Unity, trying to make nice walking/running animations. So, i found the Stealth tutorial and I used pretty much the same animator as the AI, only I only use Speed and AngularSpeed and, of course, added a control script. The controls work as intended but the whole script is laggy. I know, my Update function is really loaded, but I'm out of ideas. Any input appreciated even if it is totally irrelevant :)using UnityEngine;using System.Collections;public class Movement : MonoBehaviour {    public float speed = 0f;        //used public just to check the values    public float angularSpeed = 0f; //same    public float accTime = 1f;          public float decTime = 1f;    public float turnTime = 2.5f;    public float speedOffset = 0f;      //offsets set to let lerp go faster when approaching the target value    public float angularSpeedOffset = 0f;   //same    private float axisX = 0f;    private float axisY = 0f;    private int speedHash = Animator.StringToHash (Speed);    private int angularSpeedHash = Animator.StringToHash (AngularSpeed);    private Animator anim;    void Awake () {        anim = GetComponent<Animator>();    }    void Update () {        SpeedCalc ();        AngularSpeedCalc ();        anim.SetFloat (speedHash, speed);        anim.SetFloat (angularSpeedHash, angularSpeed);    }    void SpeedCalc () {        axisY = Input.GetAxis (Vertical);        if (axisY > 0)             speed = Mathf.Lerp (speed, 5.7f * axisY + speedOffset, accTime * Time.deltaTime);       // targets multiplied by axis input for analogue sticks to be... analogue..        else            speed = Mathf.Lerp (speed, 0f - speedOffset * 0.5f , decTime * Time.deltaTime);        if (speed >= 5.7f) speed = 5.7f        else if (speed <= 0f) speed = 0f;    }    void AngularSpeedCalc () {        axisX = Input.GetAxis (Horizontal);        if (axisX > 0 && angularSpeed >= 0f)            angularSpeed = Mathf.Lerp (angularSpeed, 2.5f * axisX + angularSpeedOffset, turnTime * Time.deltaTime);        else if (axisX < 0 && angularSpeed <= 0f)            angularSpeed = Mathf.Lerp (angularSpeed, 2.5f * axisX - angularSpeedOffset, turnTime * Time.deltaTime);        else {            if (Mathf.Abs (angularSpeed) > 0.2f)                angularSpeed = Mathf.Lerp (angularSpeed, 0f, turnTime * Time.deltaTime);            else                angularSpeed = 0f;        }        if (angularSpeed >= 2.5f) angularSpeed = 2.5f;        else if (angularSpeed <= -2.5f) angularSpeed = -2.5f;    }}
Slow update function
c#;performance;animation;unity3d