Unity/수업 내용

[Unity 2020.3] Animation Clip의 재생시간

JSH1 2021. 10. 19. 12:39

원하는 애니메이션 클립의 재생시간을 얻어오기

public Animation anim;

Animation의 Component를 얻어온다

 

anim.GetClip("애니메이션 클립 파일 이름").length

print("run: " + anim.GetClip("run@loop").length);

print는 MonoBehaviour를 상속받아야 사용할 수 있다

 

실행 결과

 


애니메이션이 재생중인지 확인

print(anim.isPlaying);

 


https://docs.unity3d.com/kr/530/ScriptReference/Animation.html