Version: 5.4
임포트한 클립의 애니메이션 커브(Animation Curves on Imported Clips)
루트 모션 노드 선택(Selecting a Root Motion Node)

Animation Events on Imported Clips

Animation Import Settings 의 애니메이션 탭에서 애니메이션 이벤트를 임포트한 애니메이션 클립에 적용할 수 있습니다.

이러한 이벤트는 애니메이션에 맞춰서 특정 행위가 언제 발생할지 결정하는 추가 정보를 임포트한 클립에 추가할 수 있도록 합니다. 예를 들어, 애니메이션화된 캐릭터에 대해서 걷거나 뛰는 동작에 이벤트를 추가해서, 발자국 소리가 언제 재생될지 표시할 수 있습니다.

임포트된 애니메이션에 이벤트를 추가하려면, 우선 프로젝트 뷰에서 임포트된 애니메이션 파일을 선택하고, 인스펙터의 임포트 설정에서 애니메이션 버튼을 클릭합니다.

임포트 설정의 애니메이션 섹션에서 애니메이션 파일 설정
임포트 설정의 애니메이션 섹션에서 애니메이션 파일 설정

인스펙터의 맨 아래까지 스크롤하면 아래와 같이 네 개의 드롭다운 항목이 나오며, 여기에 이벤트 항목이 있습니다.

The Events fold-out heading, along with the Curves, Masks, and Motion headings
The Events fold-out heading, along with the Curves, Masks, and Motion headings

Expand the events heading to reveal the events timeline for the current imported animation clip. To the left of the timeline is the Add Event button. Click it to add a new event to the timeline.

The events timeline for the current imported animation clip
The events timeline for the current imported animation clip

When adding an event, the event needs a name, which will be the name of the function that is called when the event is triggered. For any Gameobject which uses this animation in its animator, you should make sure the Gameobject has a corresponding script attached that contains a function whose name matches the event name. Below, you can see a footstep event set up to call the “Footstep” function in a script attached to the Player Gameobject.

The event dialog box shown when adding or editing an event on an imported animation
The event dialog box shown when adding or editing an event on an imported animation

You can optionally choose to specify a parameter which is also sent to the function called by the event. There are four different parameter types you can use, Float, Int, String or Object.

By filling out a value in one of these fields, and implementing your receiver function to accept a parameter of that type, you can have the value specified in the event passed through to your function in the script. For example, you could pass a float value to specify how loud the footstep should be - allowing you to have quiet footstep events on a walking loop and loud footstep events on a running loop. Or you could pass a reference to an effect prefab, allowing your script to instantiate different effects at certain points during your animation.

임포트한 클립의 애니메이션 커브(Animation Curves on Imported Clips)
루트 모션 노드 선택(Selecting a Root Motion Node)