I have a GameObject "enemy" with an Animator and several states, like "idle", "walk", and "attack".

I want to activate the "hitbox" when an animation "attack" starts. The problems is that the sword does not fall down immediately: it takes about 2 frames.

Is there a way to know what frame of the animation is currently being run?


1 Answer 1


If you open the Animation Window (Window->Animation) and select your enemy GameObject, you can insert events for certain key frames by right clicking beneath the timeline (yellow marked area).

enter image description here

You can specify your own callback for this event, which has to be a function, available on your enemy. This will then be called, whenever this keyframe is being played.

  • \$\begingroup\$ Isn't this the old animation system? \$\endgroup\$
    – Ben
    Commented Oct 8, 2015 at 2:52
  • \$\begingroup\$ @Ben This screenshot was taken from Unity 5.2 and this is the only way that I am aware of. I'm not very familiar with the whole animation system however. \$\endgroup\$ Commented Oct 8, 2015 at 7:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .