상세 컨텐츠

본문 제목

애니메이션(animation)

유니티/기능

by MJ_119 2024. 6. 26. 00:48

본문

 

 - 애니메이션 여러가지 동작 기능

using Cinemachine.Editor;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;

public class Test : MonoBehaviour
{
    private Animation anim;

    private AnimationClip clip;

    private void Start()
    {
        anim = GetComponent<Animation>();
    }

    void Update()
    {
        if ( Input.GetKeyDown(KeyCode.R) )
        {
            anim.Play("Cube_2");
            anim.PlayQueued("Cube_2");
            anim.Blend("Cube_2");
            anim.CrossFade("Cube_2");
            anim.CrossFadeQueued("Cube_2");
            if( !anim.IsPlaying("Cube_2") )
            {
                anim.Play("Cube_2");
            }
            anim.Stop();
            anim.wrapMode = WrapMode.Loop;
            anim.clip = clip;
        }
    }
}

 

 

 

@ 오류 : The AnimationClip 'Cube_2' used by the Animation component 'Cube' must be marked as Legacy.

 

해결방법 : 인스펙터창 오른쪽에 점3개를 누른뒤 디버그로 들어가서 Legacy를 체크해준다.

 

 

 

 

 

- Curves에서 원하는 애니메이션을 설정할 수 있음.

'유니티 > 기능' 카테고리의 다른 글

파티클 시스템  (0) 2024.06.27
애니메이터  (0) 2024.06.26
라이트(Light)  (0) 2024.06.26
카메라(Camera)  (0) 2024.06.25
MeshRenderer, 마우스 클릭시 오브젝트 색 바꾸기  (0) 2024.06.25

관련글 더보기