void Start() { m_Animator = GetComponent<Animator>(); m_Rigidbody = GetComponent<Rigidbody>(); m_Rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ; //set initial animation m_Animator.SetInteger("CurrentAction", (int)defaultAnimation); lastAnimation = defaultAnimation; }
void Update() { if (defaultAnimation != lastAnimation) { m_Animator.SetInteger("CurrentAction", (int)defaultAnimation); lastAnimation = defaultAnimation; } }