Unity) Animator Reset (애니메이터 초기화 코드)
Animator Reset (애니메이터 초기화 코드)
Unity 에서 Animator를 사용하다보면 Mecanim 의 상태를 초기화해서 재사용해야하는 경우가 생긴다.
그때 사용하는 유틸 코드이다.
< 코드 >
animator.Rebind();
animator.Update(0f);
animator.ResetTrigger(AnimationTriggerID);
간단하게 현재 애니메이터의 속성을 다시 바인딩하고
애니메이터의 값을 0으로 초기화하고
애니메이터의 Mecanim (State)값 도 초기화한다.
애니메이터를 재사용하는 과정에서는 해당 값을 고정으로 처리하면 된다.
Unity Animator Rebind : [링크]
Unity - Scripting API: Animator.Rebind
Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close
docs.unity3d.com
Unity Animator Reset Trigger : [링크]
Unity - Scripting API: Animator.ResetTrigger
Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close
docs.unity3d.com
Unity Animator Update : [링크]
Unity - Scripting API: Animator.Update
Success! Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable. Close
docs.unity3d.com
★☆☆☆☆