[Unity] Animation 기초

Yerin·2023년 7월 18일
0

캐릭터가 이동할때 달리는 애니메이션 적용하기

_moveToDest 는 현재 캐릭터가 달리고 있는 지를 판단하는 변수이다.

void Update()
    {
        if (_moveToDest)
        {
            Animator anim = GetComponent<Animator>();
            anim.Play("RUN"); //animation을 이름으로 지정하여 플레이 하도록 함
        }
        else
        {
            Animator anim = GetComponent<Animator>();
            anim.Play("WAIT");
        }

    }

profile
재밌는 코딩 공부

2개의 댓글

comment-user-thumbnail
2023년 7월 18일

정말 잘 정리된 내용이네요!

답글 달기
comment-user-thumbnail
2023년 7월 18일

항상 좋은 글 감사합니다.

답글 달기