본문 바로가기
Unity3d

[Unity3D] Animator 관련 IsPlaying / GetName / GetTime

by 사랑파워 2021. 3. 25.

현재 실행 중인 Animator 이름 가져오기

public GetAnimationName() {
  Animator ani;

  anim = GetComponent<Animator>();

  // 현재 애니메이터에 실행 중인 애니메이션 이름
  AnimatorClipInfo[] clipInfo;
  clipInfo = ani.GetCurrentAnimatorClipInfo(0);

  Debug.Log(clipInfo[0].clip.name);
}

현재 Animator실행 중인지 체크

    /// <summary>
    /// 현재 스크롤 아이템의 현재 실행중인 Animator가 실행 중인지 체크
    /// ani.GetCurrentAnimatorStateInfo(0).normalizedTime - 현재 진행되고 있는 애니메이션의 시간 [시작 0.0 ~ 끝 1.0]
    /// </summary>
    /// <returns></returns>
    private bool AnimatorIsPlaying()
    {
        Animator ani = GetComponent<Animator>();
        
        return ani.GetCurrentAnimatorStateInfo(0).normalizedTime < 1f;
    }

Animator 종료 후 실행

    IEnumerator WaitAnimator()
    {
        Animator ani = GetComponent<Animator>();
       
        yield return new WaitUntil(() => ani.GetCurrentAnimatorStateInfo(0).normalizedTime > 1f);

        // TODO
        // Animator 종료 후 실행
    }

Animator 안에 Animation 실행

public void PlayAnimater() {
    Animator ani = GetComponent<Animator>();
    
    ani.Play("//Animation name");
}

 


제가 개발한 두뇌발달에 좋은 결합 게임입니다

더 지니어스 프로그램에 나온 게임을 어플로 만들었습니다

재밌게 즐겨보세요!!

https://play.google.com/store/apps/details?id=com.lovepower.combinationGame

 

결합게임 - Google Play 앱

더 지니어스에 나왔던 결합게임 입니다 결합게임에는 빠른 관찰력과 냉정성이 필요로 합니다. 결합게임을 클리어하면 가넷이 주어집니다 라운드와 난이도가 높아질수록 가넷을 더욱 많이

play.google.com

건망증이 있다거나 자기 하루 스케줄 관리가 잘 안되시는 분들을 위해!! 간단한 메시지 알림 어플리케이션을 제가 직접 만들어 봤습니다!! 다운로드해 보시고 사용해보세요~

https://play.google.com/store/apps/details?id=com.lovepower.alrimi

 

알리미(Alrimi) - 메세지알림 - Google Play 앱

'대중교통이용시 시끄러운 알람말고 간단하게 알려줄수 있는 알람 없을까..?' '도서관 독서실에서 알람이 시끄러워서 맞추는지는 못하고 조용하게 알수있는 알람 없을까..?' '회사 또는 학교 에

play.google.com

 

댓글