Using Animation Events
Manual     Reference     Scripting   
Reference Manual > Animation View Guide > Using Animation Events

このドキュメントは有志により翻訳されたもので、オフィシャルではありません。オリジナルのページはこちら
This document is unofficially translated by users.Please see the original document here.

翻訳に関する修正など、ご連絡はこちらまで。
Please send e-mail to here, when you have any question about the translation.

Using Animation Events

The Animation View lets you add Animation Events to Animation Clips. Animation Events lets you call a script function similar to SendMessage as part of playing back an animation.

Animation Events support functions that take zero or one parameter. The parameter can be a float, a string, an object reference, or an AnimationEvent. In the case of functions that take an AnimationEvent as parameter, both a float, a string, and an object reference can be specified. These three will be passed as member variables of the AnimationEvent.

// This JavaScript function can be called by an Animation Event
function PrintFloat (theValue : float) {
	Debug.Log ("PrintFloat is called with a value of " + theValue);
}

An Animation Event can be added to an Animation Clip at the currently previewed frame by clicking the Event button or at any given frame by double-clicking the Event Line at the frame where the Animation Event should be. It is also possible to add an Animation Event by right-clicking the Event Line and select Add Event from the context menu. Once placed, Animation Events can be dragged around with the mouse. It is also possible to select multiple Animation Events to drag at once. Animation Events can be deleted by selecting them and pressing Delete, or by right-clicking on them and selecting Delete Event from the context menu.


Animation Events are shown in the Event Line. Add a new Animation Event by double-clicking the Event Line or by using the Event button.

Adding an Animation Event will add a marker in the Event Line and open a Animation Event dialog. In the dialog you can specify which script function to call and fill in the parameter value to pass to the function.


The Animation Event popup dialog lets you specify which function to call and fill in the parameter values.

All the Animation Events in an Animation Clip are shown as markers in the Event Line. You can quickly get see what a specific Animation Event does by holding the mouse cursor over the marker.


Holding the mouse cursor over an Animation Event marker will show which function it calls as well as the parameter value.