Home > Software engineering >  No function dropdown in AnimationEvent in Unity
No function dropdown in AnimationEvent in Unity

Time:03-24

I try to handle some events during animations, but everywhere I look, every tutorial have access to AnimatorEvent Inspector like this: enter image description here A nice simple field, where you can select a function, I want this! But instead of this, I always getting this sick 5 fields view, and don't have any idea how to handle animation event in this case! enter image description here I tried to create function test() with debug log, but it didn't work anyway. Why I can't get access to this simple window where I can choose an function?

CodePudding user response:

You will need to add this animation into a State in Animator Controller (via Animator Window).

In the object which contains Animator component, attach your script component to it.

Open the Animation window, select the object above, you will see a dropdown of animations (top left) which Animator Controller of this object contains. Choose and add event to the animation you want to.

Select the event in Animation Window, in the Inspector, you should see the dropdown of public functions of your script component attached above.

enter image description here

I don't understand the second point, so I can't pass through it. How I can attach script to animator component?

You mean attach to my enemy object animator controller and script? It's attached.

  • Related